我正在尝试在MATLAB上运行编译器,但事情没有按预期进行。如何正确安装MATLAB以及如何检查确切的错误。我有MATLAB r2013a版本。
我做了如下:
我已从here
下载了SDK 7.1文件C:\Program Files\Microsoft SDKs\Windows\v7.1
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples
我已将编译器目录添加到路径环境
接下来,我尝试使用以下步骤并使用mex -setup
命令配置MATLAB:
选择n
之后“你想要mex找到已安装的编译器”我得到了一份编译器列表(见上面的评论)。我选择了17
:
[1] Intel C++ 13.0 (with Microsoft Software Development Kit (SDK) linker)
[2] Intel C++ 13.0 (with Microsoft Visual C++ 2010 linker)
[3] Intel C++ 13.0 (with Microsoft Visual C++ 2012 linker)
[4] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker)
[5] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[6] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)
[7] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[8] Intel Visual Fortran 13 (with Microsoft Software Development Kit (SDK) linker)
[9] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2010 linker)
[10] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2012 linker)
[11] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker)
[12] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[13] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[14] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)
[15] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[16] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[17] Microsoft Software Development Kit (SDK) 7.1
[18] Microsoft Visual C++ 2005 SP1
[19] Microsoft Visual C++ 2008 SP1
[20] Microsoft Visual C++ 2010
[21] Microsoft Visual C++ 2012
警告后:
The default location for Microsoft Software Development Kit (SDK) compiler is:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0"
but either that directory does not exist or the configuration is invalid.
问题:
Use C:\Program Files (x86)\Microsoft Visual Studio 10.0 anyway [y]/n?
我选择n
并将C:\Program Files\Microsoft SDKs\Windows\v7.1
作为我的新目录
这是它停止的地方:
Error: The Microsoft Windows Software Development Kit (SDK) installation is
incomplete. Please be sure that the .NET Framework is installed
correctly before attempting to reinstall the SDK.
我的第二次尝试如下:
mex -setup
发生了以下情况:
我在问题之后选择了y
:
Would you like mex to locate installed compilers [y]/n?
[1] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
我选择了1
y
或n
获得以下2个输出我选择了n:
mex: No compiler selected. No action taken.
**************************************************************************
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:
httpx://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Error using mex (line 206)
Unable to complete successfully.
我选择了y:
***************************************************************************
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\Gebruiker\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2013a\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:
httpx://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Error using mex (line 206)
Unable to complete successfully.
我发现我遇到的问题似乎与Perl的问题有关。片刻之后会出现以下注释:
"Perl Command Line Interpreter has stopped working"
这post有类似的问题。我做了如下。我下载了Strawberry Perl并做了几次替换。
替换perl .exe文件
在这两种情况下都会出现以下内容
Can't locate shellwords.pl in @INC (@INC contains: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib . C:\PROGRA~1\MATLAB\R2013a\bin\) at C:\Program Files\MATLAB\R2013a\bin\mex.pl line 159.
Error using mex (line 206)
Unable to complete successfully.
用来自Strawberry Perl的bin文件替换bin文件
'"C:\Program Files\MATLAB\R2013a\sys\perl\win32\bin\perl.exe"' is not recognized as an internal or external command,
operable program or batch file.
Error using mex (line 206)
Unable to complete successfully.
然而,这似乎不起作用。所以似乎有两件事:
编辑:根据建议,我将matlab中的perl恢复为原始版本。
我已经下载了Visual Studio Express 2012并尝试使其工作。问题仍然存在。
答案 0 :(得分:1)
所以,我检查的第一件事是matlab支持的编译器页面:
http://www.mathworks.com/support/compilers/R2013a/index.html
我当时认为SDK 7.1不受支持,但显然它是,甚至在列表的顶部。但是,你的一个错误是抱怨.NET,在那个MATLAB页面上,有一个关于SDK 7.1需要.NET Framework 4.0的警告(在表格中,在SDK 7.1单元的底部。)
每当我在Windows中完成此操作时,我总是只使用Visual Studio编译器。我建议先尝试一下,因为我不记得这个mex-setup过程需要很长时间(成功/失败之前)。
答案 1 :(得分:0)
在安装Windows SDK之前,请确保您拥有.NET Framework 4.0。请注意,Windows 7仅附带.NET Framework 3.5,这还不够。
您可能会发现以下说明非常有用: