我有一个为 MATLAB 编写的自定义 dll,它在我们的开发机器上运行良好。但是,当我在没有开发工具的干净机器上尝试它时,我收到以下消息:
>> loadlibrary CMatLab CMatLab.h
??? Error using ==> loadlibrary at 279
Microsoft Visual C++ 2005 or 2008 is required to use this feature.
经过一些研究,似乎很明显需要编译器来在运行时解析头文件,所以我安装了标准的 Windows SDK,运行mex -setup
以选择编译器,但我仍然收到相同的错误消息。这就是我为选择编译器所做的。
>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? mex -setup
Select a compiler:
[1] Microsoft Visual C++ 2008 SP1 in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 SP1
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2008 require
that Microsoft Visual Studio 2008 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\adriane\AppData\Roaming\MathWorks\MATLAB\R2010b\mexopts.bat
From template: D:\Matlab\bin\win64\mexopts\msvc90opts.bat
Done . . .
我真的不想在这台机器上安装 Visual Studio,因为它降低了它作为我们其他工具和软件的发布版本的测试平台的实用性。有什么想法吗?我看到其他人也有同样的问题,但我没有看到明确的解决方案。操作系统是 Windows 7 pro 64 位。该dll是用VS2008构建的。