【发布时间】:2012-11-28 17:28:40
【问题描述】:
我有一个与调试 .mex32/.mex64 文件有关的问题。假设现在我有一个名为 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");
}
然后我可以使用 Visual Studio 2010 编译和构建test.mex64。然后在 matlab 中,我可以编写以下脚本来测试功能:
clc;
test;
现在假设我要调试 test.mex64 函数,我应该怎么做?已采用以下程序,但未通过:
- 使用 VS2010 在
mexPrintf行的乞求处切换断点。 - 使用 VS2010 从 Debug->Attach to Process... 选择 MATLAB.exe。
- 运行 MATLAB 脚本
clc; test;
我得到的错误信息如下:
The breakpoint will not currently be hit. No symbols have been loaded for this document.
【问题讨论】:
-
您可能想查看this question。它处理 Linux 上的 mex 分析,但类似的想法应该在 Windows 上使用。诚然,分析有点不同,但您可以从那里开始。
标签: matlab visual-c++