Mex files and compiler

15 views (last 30 days)
Antoine
Antoine on 20 Feb 2013
Hello everyone,
I have trouble to execute mex files and to set up my compiler...
My MatLab version is R2011b, so according to this page http://www.mathworks.se/support/compilers/R2011b/win32.html, it should support the following compilers (that I have): Microsoft Windows SDK 7.1 (with .NET Framework 4.0) and Microsoft Visual C++ 2010 Express.
When I use the command mex -setup, I can select the visual c++ compiler for example, and it seems to work just fine (see a copy of it at the end of this post). But after that, when I want to use it, here what I get :
-------
>> mex hello.cpp Error: Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Unable to locate compiler.
Error using mex (line 206)
Unable to complete successfully.
-------
I read a lot on the internet but unsuccessfully, I did not find any solution for my current problem... Do you think it is about the note 3 at the end of the page of the previous link ? Or because I run a 64 bits machine ?
For information, here is what I have by using the mex -setup command :
-------
>> 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/R2011b/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 Visual C++ 2008 SP1 linker)
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)
[3] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[4] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[5] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)
[7] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[8] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[9] Microsoft Software Development Kit (SDK) 7.1
[10] Microsoft Visual C++ 2005 SP1
[11] Microsoft Visual C++ 2008 SP1
[12] Microsoft Visual C++ 2010
[13] Microsoft Visual C++ 2010 Express
[0] None
Compiler: 13
Your machine has a Microsoft Visual C++ 2010 Express compiler located at C:\Program Files (x86)\Microsoft Visual Studio 10.0. Do you want to use this compiler [y]/n? y
Please verify your choices:
Compiler: Microsoft Visual C++ 2010 Express Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
*************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2010 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\Antoine\AppData\Roaming\MathWorks\MATLAB\R2011b\mexopts.bat From template: C:\PROGRA~1\MATLAB\R2011b\bin\win64\mexopts\msvc100freeopts.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/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
-------
Or again :
-------
>> mex.getCompilerConfigurations()
ans =
mex.CompilerConfiguration
Package: mex
Properties:
Name: 'Microsoft Visual C++ 2010 Express'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '10.0'
Location: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0'
Details: [1x1 mex.CompilerConfigurationDetails]
-------
If someone could enlight me a little bit, that would be great !
Thank you
  4 Comments
Antoine
Antoine on 20 Feb 2013
OK, I just did the same thing than this morning, which is deleting net framework + SDK in order to install them again. But this time I reboot my computer between the 2 installs and guess what... now it works !
I am so angry at Microsoft softwares right now ! I told myself I won't make any post for an error I could easily fix by myself, but seems like I did !
Anyway, I am really sorry for the inconvenience and thank you very much for your time !
Edoardo Alberti
Edoardo Alberti on 4 Mar 2013
Dear Antoine, I am facing the same issue as you are doing.. my matlab says
" 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. "
could you indicate what is the installation sequence that you adopted? I already uninstalled and re-installed following your suggestion to restart the machine, but apparently I am still doing something not correct.. thanks Edo

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 20 Feb 2013
  2 Comments
Antoine
Antoine on 20 Feb 2013
Yep I saw that one, but it didn't worked (see my previous comment).
Anyway, topic can be close.
Thanks
Image Analyst
Image Analyst on 4 Mar 2013
If you're done with the topic, then you click the "Accept this Answer" link.

Sign in to comment.

More Answers (1)

Ulzii
Ulzii on 8 Jun 2013
Hi guys. i have same problem like your problem. Did you solve it?. if solved already, how could you solve it ? /sorry my English not good/
thanks Ulzii
  3 Comments
Ulzii
Ulzii on 10 Jun 2013
hi, my problem is still not solved. i deinstalled every ms software then after reinstall all of this. also i try to compile many .c files , but every files same error. so i think it is not code mistake,also compiler error.
like this :
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Compile of 'zconv2S.c' failed.
Error using mex (line 206) Unable to complete successfully.
>> mex.getCompilerConfigurations()
ans =
mex.CompilerConfiguration
Package: mex
Properties:
Name: 'Microsoft Visual C++ 2010 Express'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '10.0'
Location: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0'
Details: [1x1 mex.CompilerConfigurationDetails]
Methods
Methods for class mex.CompilerConfiguration:
CompilerConfiguration
Thanks.
Kaustubha Govind
Kaustubha Govind on 10 Jun 2013
Edited: Kaustubha Govind on 10 Jun 2013
Is your error the same as the original one "Error: Could not find the compiler "cl" on the DOS path."? You didn't mention the full error message that you're seeing.

Sign in to comment.

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!