gpt4 book ai didi

c++ - 无法在 C++ 中初始化 Matlab dll

转载 作者:行者123 更新时间:2023-11-30 05:43:20 25 4
gpt4 key购买 nike

我正在使用 Windows 7 x64 和 Matlab R2012b x32 和 VS2010。

我想在 C++ 中调用名为 add 的 Matlab 函数。因此,我使用 mcc 命令将 add.m 转换为 dll,并将其添加到我的项目中。但是在尝试初始化 dll 后出现错误。

int _tmain(int argc, _TCHAR* argv[])
{
if(!addInitialize())
cout<<"addInitialize fail!!!"<<endl;
return 0;
}

输出信息:

First-chance exception at 0x74c6c42d in MatlabTest.exe: Microsoft C++ exception: MathWorks::mcli18nutil::DeployedException at memory location 0x0029eff0..
The thread 'Win32 Thread' (0xc04) has exited with code 0 (0x0).
The program '[1100] MatlabTest.exe: Native' has exited with code 0 (0x0).

最佳答案

因为我用-C选项运行mcc命令,所以我需要将add.ctf文件添加到dll所在的路径在初始化 dll 之前存储。

我也可以在没有 -C 选项的情况下再次运行 mcc 命令来生成新的 dll。并使用新的 dll 代替旧的来解决这个问题。

关于c++ - 无法在 C++ 中初始化 Matlab dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30257035/

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