title: How to direct MATLAB's mex setup to the Microsoft Windows SDK for C++ compiling? (error in setting location)
body: <p>I am on <code>Windows Vista</code>, and want to use <code>MATLAB</code> to compile <code>C++</code> functions. I had only the <code>lcc compiler</code> on the system, as can be seen when running <code>mex -setup</code> : </p>
  
  <pre><code>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/R2011a/win32.html 
  Please choose your compiler for building MEX-files: 
  Would you like mex to locate installed compilers [y]/n? y
  Select a compiler: 
  [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2011a\sys\lcc 
  [0] None 
  Compiler:
  </code></pre>
  
  <p>since lcc does not work for C++ I installed the <strong>Windows SDK 7.1</strong> from <a href="http://www.microsoft.com/en-gb/download/details.aspx?id=8279" rel="nofollow">here(windows site)</a>. I ran the <code>Windows SDK 7.1 Command Prompt</code> to see the directory it is installed to and see <code>C:\Program Files\Microsoft SDKs\Windows\v7.1</code>. I then run <code>mex -setup</code> again to set the compiler to <code>Microsoft Visual C++ 2010</code>, by telling <code>mex</code> to not locate the installed compilers, I choose the <code>Microsoft Visual C++ 2010</code> option and then the path MATLAB looks at by default is one for <code>Visual Studio</code>; <code>C:\Program Files\Microsoft Visual Studio 10.0</code>. I try to override it, but there it does not work. Here is the exact actions taken:</p>
  
  <pre><code>&gt;&gt; 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/R2011a/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++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
  [2] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
  [3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) 
  [4] Lcc-win32 C 2.4.1 
  [5] Microsoft Visual C++ 6.0 
  [6] Microsoft Visual C++ 2005 SP1 
  [7] Microsoft Visual C++ 2008 SP1 
  [8] Microsoft Visual C++ 2010 
  [9] Microsoft Visual C++ 2010 Express 
  [10] Open WATCOM C++ 
  [0] None 
  Compiler: 8
  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 SDKs\Windows\v7.1
  Please verify your choices: 
  Compiler: Microsoft Visual C++ 2010  
  Location: C:\Program Files\Microsoft Visual Studio 10.0 
  Are these correct [y]/n?  
  ***************************************************************************** 
  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 ==&gt; mex at 208
  Unable to complete successfully.
  </code></pre>
  
  <p>I do not know whether the directory should be different from <code>C:\Program Files\Microsoft SDKs\Windows\v7.1</code>, and if there is a way to identify this directory. I also do not know if the way that I give the directory is correct. I tried using single quotes around the directory name and the only variation is the that it stops to ask me whether the directory to visual studio is correct or not, I answer <strong>n</strong> and only this is given.</p>
  
  <pre><code>Compiler: Microsoft Visual C++ 2010  
  Location: C:\Program Files\Microsoft Visual Studio 10.0 
  Are these correct [y]/n? n
  mex: No compiler selected. No action taken. 
  </code></pre>
  
  <p>How can I add the compiler to MATLAB to be able to run mex on C++ funcitons/files?</p>