先说下我的环境配置:
win 7
matlab r2014a
visual studio 2010
在matlab的官网上有介绍matlab 用mex交叉编译支持的编译器。如下
http://www.mathworks.com/support/compilers/R2014a/但是我试过下载他的mex包里的文件,但是这个解决不了matlab r2014a的问题。
最终解决方案是:
按照如下说明增添一个环境变量:VS100COMNTOOLS
Running mex inverbose mode has identified the issue - I installed visual studio to anon-standard location (on my D: drive), but for some reason, the VS120COMNTOOLS environment variable was pointing to the 'C:\Program Files (x86)\MicrosoftVisual Studio 12.0\Common7\Tools\' directory. Quitting matlab and changing theenvironment variable to the correct location ('D:\Microsoft Visual Studio12.0\Common7\Tools\' in my case) fixed the issue.
源文档 <http://www.mathworks.com/matlabcentral/answers/120713-matlab-r2014a-and-visual-studio-professional-2013>
相应的VS2010和vs2015的版本添加相应的环境变量。
C:\Softwares\MicrosoftVisual Studio 10.0\Common7\Tools
C:\Softwares\MicrosoftVisual Studio 14.0\Common7\Tools
成功后截图: