win10下安装了matlab2012b,编译simulink程序需要编译器,mex -setup找不到编译器。
需要安装windows sdk7.1
下载地址为
Windows SDK 7.1 32bits下载地址:http://download.microsoft.com/download/F/1/0/F10113F5-B750-4969-A255-274341AC6BCE/GRMSDK_EN_DVD.iso
Windows SDK 7.1 64bits下载地址:http://download.microsoft.com/download/F/1/0/F10113F5-B750-4969-A255-274341AC6BCE/GRMSDKX_EN_DVD.iso
Visual c++ 2010 补丁包VC-Compiler-KB2519277下载地址:https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=4422
安装sdk的时候,由于。net的版本太高,需要做一点小修改。
第一步,卸载
Visual c++ 2010 x86 redistributable、
Visual c++ 2010 x64 redistributable(64位windows)
第二步,修改设置,增加对高版本net 4.5 4.6 4.7的支持
用记事本打开Setup文件夹下的SDKSetup.exe.config文件
在SDKSetup.exe.config文件中添加需要支持的.NET FrameWork版本
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v3.0"/>
<supportedRuntime version="v3.5"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v4.5"/>
<supportedRuntime version="v4.6"/>
<supportedRuntime version="v4.7"/>
</startup>
</configuration>
保存文件后,使用Setup文件夹下SDKSetup.exe安装。
第三步 设置mex
具体如下,注意,第一步选n,然后输入11.
>> mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2012b/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? n
Select a compiler:
[1] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker)
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[3] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)
[4] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[5] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker)
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[7] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[8] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)
[9] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[10] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[11] Microsoft Software Development Kit (SDK) 7.1
[12] Microsoft Visual C++ 2005 SP1
[13] Microsoft Visual C++ 2008 SP1
[14] Microsoft Visual C++ 2010
[15] Microsoft Visual C++ 2013
[0] None
Compiler: 11
Your machine has a Microsoft Software Development Kit (SDK) compiler located at
C:\Program Files (x86)\Microsoft Visual Studio 10.0. Do you want to use this compiler [y]/n?
Please verify your choices:
Compiler: Microsoft Software Development Kit (SDK) 7.1
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n?
***************************************************************************
Warning: MEX-files generated using Microsoft Windows Software Development
Kit (SDK) require that Microsoft Visual Studio 2010 run-time
libraries be available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\Administrator\AppData\Roaming\MathWorks\MATLAB\R2012b\mexopts.bat
From template: C:\PROGRA~1\MatLab\R2012b\bin\win64\mexopts\mssdk71opts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
安装完成