天天看点

低版本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: 
[] Intel C++  (with Microsoft Visual C++  SP1 linker) 
[] Intel C++  (with Microsoft Visual C++  linker) 
[] Intel C++  (with Microsoft Visual C++  SP1 linker) 
[] Intel Visual Fortran  (with Microsoft Visual C++  SP1 linker) 
[] Intel Visual Fortran  (with Microsoft Visual C++  Shell linker) 
[] Intel Visual Fortran  (with Microsoft Visual C++  linker) 
[] Intel Visual Fortran  (with Microsoft Visual C++  SP1 linker) 
[] Intel Visual Fortran  (with Microsoft Visual C++  Shell linker) 
[] Microsoft Software Development Kit (SDK)  
[] Microsoft Visual C++  SP1 
[] Microsoft Visual C++  SP1 
[] Microsoft Visual C++  
[] Microsoft Visual C++  Express 
[] Microsoft Visual C++  

[] None 

Compiler: 
Please select from - 
Compiler: 
           

选择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: 
[] Microsoft Visual C++  in D:\VS 

[] None 

Compiler: 
           

对于mbuild -setup也一样。

继续阅读