Use methods of a project written in C ++ in C # (In the same Solution)

0

Hello,

I need to use methods written in C ++ in a project written in C #, inside .NET (both) and that are contained in the same solution (as shown in the image below)

ItriedtocompiletheprojectsandaddtheC++projectreference(whichwascreatedinDLL->EmptyProjectmodebyvisualstudio),andwhenIaddedit(totheC#project)itwasnotavailableformetousetheclassIamdevelopinginC++

ThenIremovedthereferenceandtriedtoadditagain(becauseithadayellowtriangleonit),andnowwhenItrytoloadthereference,itshowsthefollowingerrormessage:

Could anyone help me?

I need to implement a method in assembly language, and C # does not allow me to program assembly as C ++ allows (* is a job for college, and I did not want to write the whole program in C ++, but in C #, the point is just the same assembly)

    
asked by anonymous 29.05.2017 / 04:00

1 answer

1

In the properties of your C ++ project, change the "Common Language Runtime Support" option to "Common Language Runtime Support (/ clr)" under "Configuration Properties-> General-> Project Defaults." Libraries developed without CLR can not be referenced directly in C #, so you should create your C ++ library using CLR.

    
31.05.2017 / 19:29