Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i add .h and .cpp files in a c# project?

Tags:

c++

c#

I want to add some .h and .cpp files to a C# project to get the C++ functionality in C#. I want to use the code directly without making a dll.

Can i do so? How?

like image 615
Badr Avatar asked Jun 03 '10 12:06

Badr


Video Answer


1 Answers

No you cannot. If the amount of code is small, you can write a C# class and paste pieces of the C++ code into it so that you essentially ported that class into C#. Obviously this won't work if you're using a language feature or library function that is not in C#. Alternatively you need to compile your C++ code into something executable (either a native DLL, ideally C-style flat functions, or a managed assembly) so that you can call it from your C# code.

like image 138
Kate Gregory Avatar answered Sep 30 '22 03:09

Kate Gregory