0
votes

I am having some trouble with the mex setup in terms of selecting a compiler. I have attempted to install windows SDK 7.1 but it fails each time. According to THIS forum it is because i have visual studio 10.0 installed (which I do). So ideally i should be able to set up mex with this compiler. But when i try i get the following error:

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/R2012a/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 Software Development Kit (SDK) linker) 
...
[14] Microsoft Visual C++ 2010 

[0] None 

Compiler: 14

Warning: The default location for Microsoft Visual C++ 2010 compiler is: 
     "C:\Program Files (x86)\Microsoft Visual Studio 10.0" 
     but either that directory does not exist or the configuration 
     is invalid. 

***************************************************************************** 
  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.

So obviously i do need SDK??? I have tried un-installing the SDK 7.1 from microsoft several times but no luck.

I have thought that maybe i need to manually point mex deeper into the visual studio file system in order to find the compiler, any ideas about that?

I am using Windows 7 64 bit with matlab R2012a.

Thanks for your help.

1
Are you running MATLAB 64-bit with an Express edition of Visual Studio? The Express editions don't come with a 64-bit compiler (although perhaps this is why you're trying to install the SDK?). Also, there seems to be a lot of information about this error in this thread.wakjah
Please look into the link apart from the points mentioned by @wakjahSridutt
if you answer yes y it should show a list of the detected compilers on your system that are supported by your MATLAB version. Answering no simply returns a complete list of all compilers (installed and not). If you have VS2010 Professional edition, then it should include the 64-bit compilers by default (unless you specifically unchecked them during installation). You only need the SDK for the Express editionAmro

1 Answers

1
votes

I don't know the reason for this but this is how I got it right.

  1. Uninstall all versions of Microsoft Visual C++ Redistributable from your computer.
  2. Install Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1 from here: https://www.microsoft.com/en-in/download/details.aspx?id=4422
  3. Try mex -setup again.