您的位置:首页 > 编程语言 > MATLAB

matlab r2014a 和vs产品交叉编译问题

2015-06-22 14:55 806 查看
先说下我的环境配置:

win 7

matlab r2014a

visual studio 2010

在matlab的官网上有介绍matlab 用mex交叉编译支持的编译器。如下
http://www.mathworks.com/support/compilers/R2014a/




按照上面的介绍应该是matlab 默认支持vs2010的编译器的。但是我在r2014a中用mex -setup开启交叉编译功能时,一直只有如下图的编译器选项(microsoft windows SDK 7.1)。找不到vs2010的。



我在网上有找到解决matlab r2010a对vs2010的编译器支持问题的帖子。
http://www.mathworks.com/matlabcentral/answers/93013-how-can-i-use-microsoft-visual-c-2010-to-create-mex-files-with-matlab-7-10-r2010a
但是我试过下载他的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

成功后截图:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: