我在Windows Vista
上,想用MATLAB
来编译C++
函数。我只有在系统上lcc compiler
,因为可以在运行时mex -setup
可以看出:如何将MATLAB的mex安装程序导入到用于C++编译的Microsoft Windows SDK? (设置位置出错)
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++的工作,我从here(windows site)安装的Windows SDK 7.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
是不同的,如果有一种方法来确定该目录。我也不知道我给目录的方式是否正确。我尝试在目录名称周围使用单引号,唯一的变化是它停下来询问我的视觉工作室目录是否正确,我回答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++ funcitons /文件上运行mex?
从这里? 'http:// www.microsoft.com/visualstudio/eng/downloads#d-2010-express' – Vass 2013-04-08 15:26:46
看起来像这样做。 – Alan 2013-04-08 15:34:33
'尝试更新选项文件:'C:\ Users \ Alex \ AppData \ Roaming \ MathWorks \ MATLAB \ R2011a \ mexopts.bat 从模板C:\ PROGRA〜1 \ MATLAB \ R2011a \ bin \ win32 \ mexopts \ msvc100freeopts .bat 完成。 。 。 '和编辑进行没有错误。不是一个优雅的解决方案,因为我在我的磁盘上得到了这个矮胖的东西,但是没有更好的解决方案! – Vass 2013-04-08 17:00:36