Tuesday, March 3, 2020

Debug C++ file

To debug a C++ file within a Simulink run, you compile the file with the "-g" flag. Consider the following Simulink model:

  1. Compile file: mex -g mySFunction.cpp. This will create mySFunction.mexw64 and mySFunction.mexw64.pdb.
  2. Open Visual Studio, open mySFunction.cpp
  3. Click Debug/Attach to process, select Matlab.exe.
  4. Set breakpoint in Visual Studio
  5. Run Simulink
  6. Code will stop in Visual Studio.

No comments:

Post a Comment