Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Building MEX-files - error in finding the compiler directory

Asked by Mehwish on 19 Jan 2013

I'm trying to use Kinect with Matlab using 'Simulink Support for Kinect' by Takashi Chikamasa. It tells me to install 'Microsoft Visual Studio 10.0 Express Edition (VC++)' and 'Microsoft Windows SDK 7.1' and set as a C MEX Compiler.I used the 'mex -setup' function and tried to configure the compiler, but the following errors occur. I tried to configure with the Visual Studio 10.0 as well as Windows SDK 7.1. How do I fix this problem?

>> 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/R2012b/win32.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 Software Development Kit (SDK) linker) 
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[3] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) 
[4] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[5] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker) 
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[7] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker) 
[8] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) 
[9] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[10] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) 
[11] Lcc-win32 C 2.4.1 
[12] Microsoft Software Development Kit (SDK) 7.1 
[13] Microsoft Visual C++ 2005 SP1 
[14] Microsoft Visual C++ 2008 SP1 
[15] Microsoft Visual C++ 2010 
[16] Open WATCOM C++ 
[0] None 
Compiler: 15
Warning: The default location for Microsoft Visual C++ 2010 compiler is: 
       "C:\Program Files\Microsoft Visual Studio 10.0" 
       but either that directory does not exist or the configuration 
       is invalid. 
Use C:\Program Files\Microsoft Visual Studio 10.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft     Visual Studio 10.0] C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
Please verify your choices: 
Compiler: Microsoft Visual C++ 2010  
Location: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE 
Are these correct [y]/n? y
***************************************************************************** 
Error: Microsoft Visual C++ 2010 requires the Microsoft Windows Software  
       Development Kit (SDK), but the SDK cannot be found.  Examine your   
       Microsoft Visual C++ 2010 installation. 
***************************************************************************** 
Error using mex (line 206)
Unable to complete successfully.
-----------------------------------------------------------------------

Next, I tried to use a different compiler 'Microsoft SDK 7.1'

>> 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/R2012b/win32.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 Software Development Kit (SDK) linker) 
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[3] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) 
[4] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[5] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker) 
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[7] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker) 
[8] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) 
[9] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[10] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) 
[11] Lcc-win32 C 2.4.1 
[12] Microsoft Software Development Kit (SDK) 7.1 
[13] Microsoft Visual C++ 2005 SP1 
[14] Microsoft Visual C++ 2008 SP1 
[15] Microsoft Visual C++ 2010 
[16] Open WATCOM C++ 
[0] None 
Compiler: 12
Warning: The default location for Microsoft Software Development Kit (SDK) compiler is: 
       "C:\Program Files\Microsoft Visual Studio 10.0" 
       but either that directory does not exist or the configuration 
       is invalid. 
Use C:\Program Files\Microsoft Visual Studio 10.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft  Visual Studio 10.0] C:\Program Files\Microsoft Visual Studio 10.0\Microsoft SDKs\F#\3.0\Framework\v4.0
Please verify your choices: 
Compiler: Microsoft Software Development Kit (SDK) 7.1 
Location: C:\Program Files\Microsoft Visual Studio 10.0\Microsoft SDKs\F#\3.0\Framework\v4.0 
Are these correct [y]/n? y
 ***************************************************************************** 
  Error: A part of the Microsoft Windows Software Development Kit (SDK) cannot 
         be found.  Please consider reinstalling while paying special attention  
         to all the install screens.  Be sure to install the .NET Framework. 
***************************************************************************** 
Error using mex (line 206)
Unable to complete successfully.

>>

0 Comments

Mehwish

Products

No products are associated with this question.

1 Answer

Answer by Jan Simon on 19 Jan 2013
Accepted answer

Did you search in the forum already? There are so many questions about a failing installation of Microsoft compilers that I'm wondering, if Microsoft itself does not offer a useful forum to support users.

The installation is tricky. Try it again using the instructions you find in the forum and on Matlab's help pages (the links can be found in the forum also, of by Google).

4 Comments

Jan Simon on 20 Jan 2013

Please explain, which solutions you have tried already.

Kaustubha Govind on 21 Jan 2013

Mehwish: One thing that I'd recommend is to make sure that "mex -setup" is able to locate the installed compilers automatically. If you have to answer "n" to "Would you like mex to locate installed compilers [y]/n?", it means there's something wrong with your compiler installation.

Mehwish on 22 Jan 2013

Hi Jan & Kaustubha,

I was able to solve the problem today. For "Would you like mex to locate installed compilers [y]/n?", I selected "n".

A list of compilers came up. I selected "Microsoft Visual C++ 2010".

Next, to solve the problem regarding the directory, I found the following link to be very helpful: http://www.mathworks.com/matlabcentral/answers/27759#answer_36115

"I had to copy "mspdb100.dll" from the "..\Microsoft Visual Studio 10.0\Common7\IDE\" to the "..\Microsoft Visual Studio 10.0\VC\bin\"."

So, I typed the location in the directory as follows: Location: C:\Program Files\Microsoft Visual Studio 10.0\VC\bin

And it worked! The help for this problem was around all this time... I wouldn't have guessed to look into that specific file. :)

Jan Simon

Contact us