Unable to debug C-MEX source files under Matlab R2017b and Visual Studio Community 2017

1 次查看(过去 30 天)
Hi, I am recently writing C-MEX files but I find I am unable to debug the code. I use Matlab R2017b and Visual Studio Community 2017, and follow the debug instructions in here (specify '-g' option when compiling, attach MATLAB process to Visual Studio, and set breakpoints), but when I run the mex file, it just went through all the breakpoints and produce the result, not pausing at any of the breakpoints.
I wish to know how to solve this problem? Did I miss some steps?
Microsoft Visual C++ (2017) is the only compiler I have installed. And here is the installed components. Did I miss some components?

回答(1 个)

Ran Chen
Ran Chen 2018-8-9
Hello,
I understand that you are unable to reach the breakpoint in Visual Studio. Unfortunately, I cannot reproduce the issue on my end. MATLAB R2017b supports debugging with the Visual Studio Community 2017, and it seems that you have all the proper tools installed.
The process you run the code using command in MATLAB should work the same as you click the run button in the Visual Studio in debug mode. Please make sure of the following:
1. Please make sure you are compiling the MEX file using the ‘-g’ flag.
2. Please make sure you are attaching the correct MATLAB process that is used to execute the MEX file.
3. Please check whether breakpoints are set in lines which are reachable at runtime.
If you still experiencing the issue, you may consider getting more information from the Visual Studio support team.

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

产品


版本

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by