我试图在MATLAB上运行一个编译器,但事情并没有如预期的那样进行。如何正确安装MATLAB,以及如何检查到底出了什么问题。我有MATLAB r2013a版本。
我已经做了如下操作:
-
我已经从下载了SDK 7.1文件
here
-
工具的目标文件夹:
C:\Program Files\Microsoft SDKs\Windows\v7.1
-
示例的目标文件夹:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples
-
我已将编译器目录添加到路径环境中
-
控制面板->系统->“高级”->“环境变量”。
-
名为“MSSdk”的新系统变量。
-
此变量的值:C:\Program Files\Microsoft SDK \Windows\v7.1
-
关闭并重新启动MATLAB
接下来,我尝试使用以下步骤配置MATLAB,并使用
mex -setup
命令:
-
选择之后
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 SDK \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.
编辑:
我的第二次尝试如下:
-
我删除了所有visual basic文件(通过删除程序中作为visual basic列出的所有项目)
-
我重新安装了SDK文件,但取消了visual c++编译器和Microsoft visual c++
-
应用
patch
从Microsoft到SDK 7.1安装(如果尚未完成)
-
已重新安装Visual C++2010可再发行软件包:x86和x64
-
在MATLAB中,我再次使用
mex-设置
发生了以下情况:
我选择了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
并进行了几次更换。
-
替换所有exe文件
-
替换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.
然而,这似乎并不奏效。因此,似乎有两件事:
-
它不是那样工作的(只有一个人声称他这样做了)
-
我正在用Strawberry Perl中的文件替换MATLAB中的错误文件。
编辑:按照建议,我将matlab中的perl恢复到原来的版本。
我已经下载了Visual Studio Express 2012,并试图使其正常工作。问题依然存在。