Search Ubuntu life...

Custom Search

Saturday, July 19, 2008

Visual Studio C++ and MEX 2007b in x64 WinXP

To use VS C++ free compilers with Matlab 2007b MEX in x64 WinXP machines:
  • Install VS C++ free components
    1. Download vcsetup.exe for Visual Studio C++ 2008 Express Edition
    2. Run it to install the free Visual Studio C++ components (ignoring the optional ones).
    3. Download setup.exe of Windows SDK for Windows Server 2008 and .NET Framework 3.5
    4. Run it to install Windows SDK.
  • Let Matlab know where Windows SDK resides:
    1. Set environment variable MSSDK to C:\Program Files\Microsoft SDKs\Windows\v6.0A
    2. Run cmd and mex -setup in it (alternatively, open matlab and give mex -setup in the matlab command prompt).
    • Answer 'no' to the suggestion of mex to automatically locate compilers,
    • choose Microsoft Visual C++ 2005 in the list that appears,
    • answer 'no' to the suggestion for the default path of VS C++ and then,
    • give C:\Program Files\Microsoft SDKs\Windows\v6.0A as the new path for VS C++.
  • To compile mex files:
    1. Navigate with Win Explorer to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin and double click Visual Studio 2008 x64 Win64 Command Prompt
    2. In that terminal, navigate (using command cd) to the directories where YOUR C/C++ code is located and make the mexw64 file(s).