天天看點

低版本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也一樣。

繼續閱讀