我在Windows Vista
,并且想用它MATLAB
来编译C++
函数。我只有lcc compiler
系统上的,运行时可以看到mex -setup
:
mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2011a\sys\lcc
[0] None
Compiler:
因为 lcc 不适用于 C++,所以我从这里(windows 站点)安装了Windows SDK 7.1。我跑来查看它安装到的目录并查看. 然后我再次运行将编译器设置为,告诉不要找到已安装的编译器,我选择该选项,然后 MATLAB 默认查看的路径是; . 我尝试覆盖它,但在那里它不起作用。以下是采取的具体行动:Windows SDK 7.1 Command Prompt
C:\Program Files\Microsoft SDKs\Windows\v7.1
mex -setup
Microsoft Visual C++ 2010
mex
Microsoft Visual C++ 2010
Visual Studio
C:\Program Files\Microsoft Visual Studio 10.0
>> mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? n
Select a compiler:
[1] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[2] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[4] Lcc-win32 C 2.4.1
[5] Microsoft Visual C++ 6.0
[6] Microsoft Visual C++ 2005 SP1
[7] Microsoft Visual C++ 2008 SP1
[8] Microsoft Visual C++ 2010
[9] Microsoft Visual C++ 2010 Express
[10] Open WATCOM C++
[0] None
Compiler: 8
Warning: The default location for Microsoft Visual C++ 2010 compiler is:
"C:\Program Files\Microsoft Visual Studio 10.0"
but either that directory does not exist or the configuration
is invalid.
Use C:\Program Files\Microsoft Visual Studio 10.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio 10.0]
C:\Program Files\Microsoft SDKs\Windows\v7.1
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files\Microsoft Visual Studio 10.0
Are these correct [y]/n?
*****************************************************************************
Error: Microsoft Visual C++ 2010 requires the Microsoft Windows Software
Development Kit (SDK), but the SDK cannot be found. Examine your
Microsoft Visual C++ 2010 installation.
*****************************************************************************
??? Error using ==> mex at 208
Unable to complete successfully.
我不知道该目录是否应该与 不同C:\Program Files\Microsoft SDKs\Windows\v7.1
,以及是否有办法识别该目录。我也不知道我给目录的方式是否正确。我尝试在目录名称周围使用单引号,唯一的变化是它停止询问我 Visual Studio 的目录是否正确,我回答n并且只给出这个。
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files\Microsoft Visual Studio 10.0
Are these correct [y]/n? n
mex: No compiler selected. No action taken.
如何将编译器添加到 MATLAB 以便能够在 C++ 函数/文件上运行 mex?