使用 Visual Studio 2013 的 C 编译器进行 MATLAB

Using Visual Studio 2013's C compiler for MATLAB

本文关键字:编译器 MATLAB Visual Studio 2013 使用      更新时间:2023-10-16

我使用mex -setup命令添加了Visual Studio 2013作为MATLAB的默认C编译器。我使用在互联网上找到的下载文件添加了Visual Studio 2013,并附有以下说明。

The files 
  * msvc120engmatopts.bat
  * msvc120opts.bat
  * msvc120opts.stp
should be copied to C:Program FilesMATLABR2013abinwin64mexopts .
The files 
  * msvc120compp.bat
  * msvc120compp.stp
should be copied to C:Program FilesMATLABR2013abinwin64mbuildopts .

我的MATLAB版本是R2011b,所以我适当地替换了路径。

下面是我用它来运行一个C函数来验证编译器是否被链接。

日志文件

我从这个答案中发现了这个方法。

但是,当我在Simulink模型中使用MATLAB函数时,我得到以下错误消息,就像我将VS2013编译器链接到MATLAB之前一样。

Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks.
Use 'mex -setup' to select a supported C-compiler.

好吧,所以唯一适用于我的MATLAB"R2011b"版本的是Microsoft SDK 7.1,因为其他编译器对于Windows 7 64位来说太旧了。不支持MinGW-64位。虽然它在MATLAB上工作,但它不被Stateflow识别。

所以我从下载了。iso文件在这里

如果您在安装SDK时遇到任何困难,请尝试this