matlab编译安装问题
我正在尝试在 MATLAB 上运行编译器,但事情没有按预期进行.如何正确安装 MATLAB 以及如何检查到底出了什么问题.我有 MATLAB r2013a 版本.
I'm trying to run a compiler on MATLAB but things don't go as expected. How can I properly install MATLAB and how can I check what exactly is going wrong. I have the MATLAB r2013a version.
我做了如下:
我已经从 下载了 SDK 7.1 文件这里
- 工具的目标文件夹:
C:Program FilesMicrosoft SDKsWindowsv7.1
- 示例的目标文件夹:
C:Program FilesMicrosoft SDKsWindowsv7.1Samples
我已将编译器目录添加到路径环境中
I've added my compiler directories to the path environment
- 控制面板 -> 系统 -> 高级" -> 环境变量".
- 名为MSSdk"的新系统变量.
- 该变量的值:C:Program FilesMicrosoft SDKsWindowsv7.1
- 关闭并重新启动 MATLAB
接下来,我尝试使用以下步骤和 mex -setup
命令配置 MATLAB:
Next I tried to configure MATLAB using following steps and using the mex -setup
command:
通过您是否希望 mex 来定位已安装的编译器"选择
n
后,我得到了一个编译器列表(请参阅上面的评论).我选择了17
:
after choosing
n
by "would you like mex to locate installed compilers" i got a list of compilers (see comment above). I've selected17
:
[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
以下警告:
Following warning:
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.
问题:
Question:
Use C:Program Files (x86)Microsoft Visual Studio 10.0 anyway [y]/n?
我选择了 n
并将 C:Program FilesMicrosoft SDKsWindowsv7.1
作为我的新目录
I've chosen n
and gave C:Program FilesMicrosoft SDKsWindowsv7.1
as my new directory
这里是它停止的地方:
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.
我的第二次尝试如下:
My second attempt I did as follow:
- 我删除了所有visual basic文件(通过删除程序中列为visual basic的所有项目)
- 我再次重新安装了 SDK 文件,但未选中 Visual C++ 编译器和 Microsoft Visual C++
- 应用补丁Microsoft 到 SDK 7.1 安装(如果尚未完成)
- 重新安装了 Visual C++ 2010 Redistributable 软件包:x86 和 x64
- 在 MATLAB 中我再次使用了
mex -setup
- I removed all visual basic files (by removing all items listed as visual basic in programs)
- I re-installed the SDK file again but uncheked visual c++ compilers and Microsoft visual c++
- Apply the patch from Microsoft onto the SDK 7.1 installation (if not done already)
- Reinstalled the Visual C++ 2010 Redistributable packages: both x86 and x64
- In MATLAB I again used
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
我选择了 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:UsersGebruikerAppDataRoamingMathWorksMATLABR2013amexopts.bat
From template: C:PROGRA~1MATLABR2013ainwin64mexoptsmssdk71opts.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 的问题无关.短暂出现以下注释:
I've found that the problem I'm facing seems to be isolated to a problem with Perl. For a brief moment the following note appears:
"Perl Command Line Interpreter has stopped working"
这个 post 也有类似的问题.我做了如下.我下载了 Strawberry Perl 并做了几次替换.
This post had a similar problem. I did as follow. I downloaded Strawberry Perl and did several replacements.
- 替换所有exe文件
替换 perl .exe 文件
- replacing all exe files
replacing perl .exe files
在这两种情况下都会出现以下情况
In both situations the following appears
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~1MATLABR2013ain) at C:Program FilesMATLABR2013ainmex.pl line 159.
Error using mex (line 206)
Unable to complete successfully.
用 Strawberry Perl 的 bin 文件替换 bin 文件
replacing bin file with bin file from Strawberry Perl
'"C:Program FilesMATLABR2013asysperlwin32inperl.exe"' is not recognized as an internal or external command,
operable program or batch file.
Error using mex (line 206)
Unable to complete successfully.
但是这似乎不起作用.所以这似乎是两件事:
However this doesn't seems to work. So it seems to be two things:
- 这行不通(只有一个人声称他已经这样做了)
- 我正在用 Strawberry Perl 中的文件替换 MATLAB 中的错误文件.
按照建议,我将 matlab 中的 perl 恢复为原始版本.
As recommended I restored the perl in matlab to it's original version.
我已经下载了 Visual Studio Express 2012 并尝试完成这项工作.问题还是一样.
I've downloaded Visual Studio Express 2012 and trying to make this work. Problems are still the same.
所以,我检查的第一件事是 matlab 支持的编译器页面:
http://www.mathworks.com/support/compilers/R2013a/index.html
So, the first thing I checked was the matlab supported compilers page:
http://www.mathworks.com/support/compilers/R2013a/index.html
我认为 SDK 7.1 不会得到支持,但显然它是,甚至在列表的顶部.但是,您的错误之一是抱怨 .NET,并且在那个 MATLAB 页面上,有一个关于 SDK 7.1 需要 .NET Framework 4.0 的警告(在表格中,在 SDK 7.1 单元格的底部.)
I was thinking that SDK 7.1 would not be supported, but clearly it is, and is even at the top of the list. However, one of your errors was complaining about .NET, and on that MATLAB page, there is a caveat about SDK 7.1 needing .NET Framework 4.0 (in table, at the bottom of the SDK 7.1 cell.)
每当我在 Windows 中执行此操作时,我总是只使用 Visual Studio 编译器.我建议先尝试一下,因为我不记得这个 mex 设置过程需要很长时间(在成功/失败之前).
Whenever I've done this in windows, I've always just used the Visual Studio compiler. I would suggest trying that first, since I don't remember this mex-setup process taking very long (before success/failure).