I have a question related to debugging .mex32/.mex64 files. Suppose now I have a file named test.cpp:
#include "mex.h"
#include <iostream>
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
mexPrintf("Hello Matlab, and this is a test program\n");
}
I can then compile and build test.mex64
with Visual Studio 2010.Then in matlab, I can write the following script to test the function:
clc;
test;
Now suppose I want to debug the test.mex64 function, what should I do? The have adopted the following procedure, but failed:
- Toggle break point at the begging of the line
mexPrintf
with VS2010. - With VS2010 from Debug->Attach to Process... select MATLAB.exe.
- Run MATLAB script
clc; test;
The error message I have obtained is as follows:
The breakpoint will not currently be hit. No symbols have been loaded for this document.