matlab2013不支持vs2013

matlab2013不支持vs2013,因此使用

  1. mex -setup  
mex -setup

会提示无法找到编译器


解决方法很简单,思路就是vs2013和vs2012在c++编译器部分应该基本一样。

1、在setup后选择N

  1. Would you like mex to locate installed compilers [y]/n? n  
  2.    
  3. Select a compiler:   
  4. [1] Intel C++ 13.0 (with Microsoft Software Development Kit (SDK) linker)   
  5. [2] Intel C++ 13.0 (with Microsoft Visual C++ 2010 linker)   
  6. [3] Intel C++ 13.0 (with Microsoft Visual C++ 2012 linker)   
  7. [4] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker)   
  8. [5] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker)   
  9. [6] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)   
  10. [7] Intel Visual Fortran 13 (with Microsoft Software Development Kit (SDK) linker)   
  11. [8] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2010 linker)   
  12. [9] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2012 linker)   
  13. [10] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker)   
  14. [11] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)   
  15. [12] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)   
  16. [13] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)   
  17. [14] Microsoft Software Development Kit (SDK) 7.1   
  18. [15] Microsoft Visual C++ 2005 SP1   
  19. [16] Microsoft Visual C++ 2008 SP1   
  20. [17] Microsoft Visual C++ 2010   
  21. [18] Microsoft Visual C++ 2012   
Would you like mex to locate installed compilers [y]/n? n
 
Select a compiler: 
[1] Intel C++ 13.0 (with Microsoft Software Development Kit (SDK) linker) 
[2] Intel C++ 13.0 (with Microsoft Visual C++ 2010 linker) 
[3] Intel C++ 13.0 (with Microsoft Visual C++ 2012 linker) 
[4] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker) 
[5] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[6] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) 
[7] Intel Visual Fortran 13 (with Microsoft Software Development Kit (SDK) linker) 
[8] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2010 linker) 
[9] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2012 linker) 
[10] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker) 
[11] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[12] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker) 
[13] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) 
[14] Microsoft Software Development Kit (SDK) 7.1 
[15] Microsoft Visual C++ 2005 SP1 
[16] Microsoft Visual C++ 2008 SP1 
[17] Microsoft Visual C++ 2010 
[18] Microsoft Visual C++ 2012 

2、选vs2012 即18

3、把默认目录改成vs2013的目录

  1. Use C:\Program Files (x86)\Microsoft Visual Studio 11.0 anyway [y]/n? n  
  2. Please enter the location of your compiler: [C:\Program Files (x86)\Microsoft Visual Studio 11.0] C:\Program Files (x86)\Microsoft Visual Studio 12.0  
Use C:\Program Files (x86)\Microsoft Visual Studio 11.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files (x86)\Microsoft Visual Studio 11.0] C:\Program Files (x86)\Microsoft Visual Studio 12.0

4、安装成功


编译的时候可能出现lib文件找不到问题:

  1. LINK : fatal error LNK1181: cannot open input file 'gdi32.lib'   
LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' 


大概查了一下发现是编译器的升级,在win8、vs2013下这个已经没有了,根本不需要。因此直接删了就行。

找到

  1. C:\Users\****\AppData\Roaming\MathWorks\MATLAB\R2013b  
C:\Users\****\AppData\Roaming\MathWorks\MATLAB\R2013b

右键编辑 mexopts.bat,把对应行改成这样:(删掉除了kernel32.lib 与user32.lib 之后的所有lib)

  1. set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib  /nologo /manifest   
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib  /nologo /manifest 


再编译就成功了!


转自:http://blog.csdn.net/keithsky/article/details/20306397

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值