Using Visual Studio 2013's C compiler for MATLAB

主宰稳场 提交于 2020-02-25 04:59:06

问题


I added Visual Studio 2013 as the default C compiler for MATLAB using the mex -setup command. I added Visual Studio 2013 using a download I found on the internet with the following instructions.

The files 
  * msvc120engmatopts.bat
  * msvc120opts.bat
  * msvc120opts.stp
should be copied to C:\Program Files\MATLAB\R2013a\bin\win64\mexopts .

The files 
  * msvc120compp.bat
  * msvc120compp.stp
should be copied to C:\Program Files\MATLAB\R2013a\bin\win64\mbuildopts .

My version of MATLAB is R2011b, so I replaced the path appropriately.

Here's me using it to run a C function to verify if the compiler has been linked.

Log File

I found out about this method from this answer.

However, when I use a MATLAB function within a Simulink Model, I get the following error message just like I did before I linked the VS2013 compiler to MATLAB.

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

回答1:


Okay, so the only thing that works for my version of MATLAB "R2011b" is Microsoft SDK 7.1 since the other compilers are too old for Windows 7 64 bit. MinGW-64 bit is unsupported. Although it works on MATLAB it is not recognized by Stateflow.

So I just downloaded the .iso file from here.

If you face any difficulty while installing the SDK, then try this.



来源:https://stackoverflow.com/questions/23868529/using-visual-studio-2013s-c-compiler-for-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!