【Matlab2016使用mex命令寻找编辑器Visual Studio2019】

【Matlab2016使用mex命令寻找编辑器Visual Studio2019】

最近想要同时使用VS和matlab进行编程,但是怎么都没有办法让matlab找到VS,经过多方查询,特意在此记录。

问题:mex命令报错

mex -setup
错误使用 mex
未找到支持的编译器或 SDK。您可以安装免费提供的 MinGW-w64 C/C++ 编译器;请参阅安装 MinGW-w64 编译器。有关更多选项,请访问 http://www.mathworks.com/support/compilers/R2016b/win64.html。

发现问题是由于没办法找到编译器导致的,所以使用了详细模式查看具体原因,命令如下:

mex -setup -v
详细模式已开。
… 正在查找编译器 ‘Intel C++ Composer XE 2013 with Microsoft SDK 7.1 ©’…
… 正在查找环境变量 ‘ICPP_COMPILER14’…否。
… 正在查找环境变量 ‘ICPP_COMPILER13’…否。
找不到已安装的编译器 ‘Intel C++ Composer XE 2013 with Microsoft SDK 7.1 ©’。
… 正在查找编译器 ‘Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012 ©’…
… 正在查找环境变量 ‘ICPP_COMPILER14’…否。
… 正在查找环境变量 ‘ICPP_COMPILER13’…否。
找不到已安装的编译器 ‘Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012 ©’。
… 正在查找编译器 ‘Intel C++ Composer XE 2013 with Microsoft Visual Studio 2013 ©’…
… 正在查找环境变量 ‘ICPP_COMPILER14’…否。
… 正在查找环境变量 ‘ICPP_COMPILER13’…否。
找不到已安装的编译器 ‘Intel C++ Composer XE 2013 with Microsoft Visual Studio 2013 ©’。
… 正在查找编译器 ‘Intel Parallel Studio XE 2015 with Microsoft SDK 7.1 ©’…
… 正在查找环境变量 ‘ICPP_COMPILER15’…否。
找不到已安装的编译器 ‘I