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:
mexPrintf
with VS2010.clc; test;
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.
您是否使用调试选项“-g”构建了您的 mex 文件?
I have found the solution: when I created the .mexw64 function (test.mexw64 in our case), I copied it to the MATLAB work directory. In order to debug this function, it is important to copy test.pdb file to the MATLAB work directory as well. After doing that, I can debug.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.