none
How to integrate C/C++ source code into C# project RRS feed

  • Question

  • Now I have some UI source code written in C#, and my algorithm written in C/C++, I wanna add C/C++ source code(not DLL) in C# project for visually debugging, Is it possible? if so, how to do it

    I know firstly compling C/C++ as DLL file ,and then calling  the  C/C++ dll file in C# project is possible, but it is not what I want, because debugging in this way is not convenient, what i want is compliling C# UI code and C/C++ algorithm code at the same time, and display at the same time, like MATLAB does 

    regard.

    Thursday, December 12, 2019 3:25 AM

Answers

All replies

  • If you put both project into same solution, you should be able to debug them conveniently with mixed mode debugging enabled.

    https://stackoverflow.com/questions/1744888/cannot-debug-unmanaged-dll-from-c-sharp

    Thursday, December 12, 2019 3:36 AM
    Answerer
  • That means,  one solution contains two projects: 1) C# UI    2) C/C++ code, they can work together seamlessly, am I right?   in VS2015,  C# project->property->Debug, there is no  "Enable unmanaged code debugging"  item, but is as below 

    I select the "Enable native code debugging", is it right?

    Are there axamples of C# & C/C++ mixed programing available?  thanks a lot

    Thursday, December 12, 2019 6:15 AM
  • Yes, I think it should be "Enable native code debugging" option.

    I don't have this kind of example. My current job does not use C#, and I can only offer limited support (Anything that could be typed in notepad and compile with csc.exe directly).

    Thursday, December 12, 2019 6:32 AM
    Answerer
  • Hi Hitbuyi,

    Thank you for posting here.

    Based on my search, this link may be helpful to you.

    Tutorial: Debug C# and C++ in the same debugging session.

    Best Regards, 

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Thursday, December 12, 2019 8:02 AM