我在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++,所以我从这里(窗口站点)安装了WindowsSDK7.1。我运行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选项,然后MATLAB默认查看的路径是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?
发布于 2013-04-08 15:21:48
如果你追求的是快速和简单的方法(不要使用64位matlab),我建议你下载一份免费的VisualStudio2010VisualStudio2010 C++表达式并使用它。这样,mex -setup就能检测到它。
https://stackoverflow.com/questions/15882696
复制相似问题