问题
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.
I've done as follow:
I've downloaded the SDK 7.1 file from here
- destination folder for Tools:
C:\Program Files\Microsoft SDKs\Windows\v7.1
- destination folder for Samples:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples
- destination folder for Tools:
I've added my compiler directories to the path environment
- Control Panel -> System -> "Advanced" -> "Environment variables".
- new system variable with the name "MSSdk".
- value of this variable: C:\Program Files\Microsoft SDKs\Windows\v7.1
- close and restart MATLAB
Next I tried to configure MATLAB using following steps and using the mex -setup
command:
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?
I've chosen
n
and gaveC:\Program Files\Microsoft SDKs\Windows\v7.1
as my new directory
here is where it stops:
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.
EDIT:
My second attempt I did as follow:
- 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
The following happened:
I've chosen
y
after the question: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
I've chosen
1
- and then I get the following 2 outputs depending on choosing
y
orn
after asking if this is correct
i selected 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.
i selected 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.
EDIT:
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"
This post had a similar problem. I did as follow. I downloaded Strawberry Perl and did several replacements.
- 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~1\MATLAB\R2013a\bin\) at C:\Program Files\MATLAB\R2013a\bin\mex.pl line 159. Error using mex (line 206) Unable to complete successfully.
replacing bin file with bin file from Strawberry Perl
'"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.
However this doesn't seems to work. So it seems to be two things:
- It doesn't work that way (only one person claimed he has done this)
- I'm replacing the wrong files in MATLAB with the one in Strawberry Perl.
EDIT: As recommended I restored the perl in matlab to it's original version.
I've downloaded Visual Studio Express 2012 and trying to make this work. Problems are still the same.
回答1:
So, the first thing I checked was the matlab supported compilers page:
http://www.mathworks.com/support/compilers/R2013a/index.html
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.)
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).
回答2:
Make sure you have .NET Framework 4.0 before installing Windows SDK. Note that Windows 7 ships with only .NET Framework 3.5, which is not enough.
You might find the following instructions useful:
How do I install Microsoft Windows SDK 7.1?
来源:https://stackoverflow.com/questions/18405307/matlab-compiler-installation-problems