gpt4 book ai didi

matlab - 如何使用 Visual Studio 2010 调试 MATLAB .mex32/.mex64 文件

转载 作者:行者123 更新时间:2023-12-04 05:21:44 24 4
gpt4 key购买 nike

我有一个与调试 .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");
}

然后我可以编译和构建 test.mex64使用Visual Studio 2010。然后在matlab中,我可以编写以下脚本来测试该功能:
clc; 
test;

现在假设我想调试 test.mex64 函数,我该怎么做?已采用以下程序,但失败了:
  • 在行的开始处切换断点 mexPrintf与 VS2010。
  • 使用 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. 

    最佳答案

    您是否使用调试选项“-g”构建了您的 mex 文件?

    关于matlab - 如何使用 Visual Studio 2010 调试 MATLAB .mex32/.mex64 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13610959/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com