低版本MATLAB mex -setup找不到VS2013解决办法

在MATLAB中键入mex -setup,出现由于MATLAB版本过低而找不到相应的VS的情况。比如我的只找到了VS2010。总不可能再下载一个VS2010或者新版MATLAB吧。。。
我的MATLAB版本为2011b,只能搜到VS2010。这种情况下,去官网下载文件:
http://www.mathworks.com/matlabcentral/fileexchange/44408-matlab-mex-support-for-visual-studio-2013–and-mbuild-
按照readme中的要求复制文件即可。当然相应的路径设置成你自己的。

官网上的MATLAB版本是R2013a,但是我在自己的Matlab 2011b上试也成功了。
文件都复制完后在MATLAB中键入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/R2011b/win64.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++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) 
[3] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[4] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[5] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker) 
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) 
[7] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[8] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) 
[9] Microsoft Software Development Kit (SDK) 7.1 
[10] Microsoft Visual C++ 2005 SP1 
[11] Microsoft Visual C++ 2008 SP1 
[12] Microsoft Visual C++ 2010 
[13] Microsoft Visual C++ 2010 Express 
[14] Microsoft Visual C++ 2013 

[0] None 

Compiler: 
Please select from 0-14 
Compiler: 14

选择VS2013
然后后面的检查路径正确都是yes就好了。

以后进入时

>> 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/R2011b/win64.html 

Please choose your compiler for building MEX-files: 

Would you like mex to locate installed compilers [y]/n? y

回复yes

Select a compiler: 
[1] Microsoft Visual C++ 2013 in D:\VS 

[0] None 

Compiler: 1

对于mbuild -setup也一样。

猜你喜欢

转载自blog.csdn.net/qq_22522663/article/details/50470257
Mex
今日推荐