How can I set up Microsoft Visual Studio 2008 Express Edition for use with MATLAB 7.7 (R2008b) on 64-bit Windows?
16 views (last 30 days)
Show older comments
MathWorks Support Team
on 22 Apr 2013
Edited: MathWorks Support Team
on 26 Sep 2019
I would like to set up Microsoft Visual Studio 2008 Express Edition for use with MATLAB 7.7 (R2008b) on 64-bit Windows.
Accepted Answer
MathWorks Support Team
on 26 Sep 2019
Edited: MathWorks Support Team
on 26 Sep 2019
The support for Microsoft Visual Studio 2008 Express Edition to create MEX files has been added in MATLAB 7.7 (R2008b). On 64-bit Windows, Visual Studio 2008 Express Edition support requires you to install some optional components as detailed below. Note that in some cases, the configuration steps described below are known to work with MATLAB 7.8 (R2009a), MATLAB 7.9 (R2009b) and MATLAB 7.10 (R2010a) as well.
For later versions of MATLAB, please refer to our supported compilers page for 64-bit Windows systems:
<http://www.mathworks.com/support/compilers>
When using 64-bit MATLAB on 64-bit Windows, you must use a 64-bit compiler to build MEX-files, MATLAB Compiler & Builder components, Simulink S-functions, RTW models, etc. The full list of supported products is available at:
The default installation of Visual Studio 2008 Express is only capable of building 32-bit binaries, and will not work with MATLAB.
In order to build 64-bit binaries, the "x64 Compilers and Tools" and Microsoft Windows Software Development Kit (SDK) must both be installed. The x64 Compilers and Tools are not installed by default.
Without these packages, Visual Studio can build simple C/C++ applications as 32-bit binaries --- "Hello World" type programs compile and execute as expected. However, Visual Studio cannot build the 64-bit binaries MATLAB requires.
To install Visual Studio 2008 Express Edition with all required components:
1. Install Microsoft Visual Studio 2008 Express Edition. The main Visual Studio 2008 Express installer is available from (the C++ installer name is vcsetup.exe):
This package can be installed using the default options.
2. Install the Microsoft Windows SDK. The Microsoft Windows SDK is available by searching Microsoft's download site.
Download the Windows Server 2008 & .NET 3.5 SDK. Do not install beta or 'Release Candidate' (RC) versions. Also do NOT install "Microsoft Windows SDK for Windows 7 and .NET Framework 4" (version 7.1); if you want to use a 7.x version choose the "Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1".
2.1. While installing the SDK, you must select "x64 Compilers and Tools". For example, in the SDK installer above:
On the screen "Installation Options"
Select "Developer Tools"->"Visual C++ Compilers".
This item has the Feature Description "Install the Visual C++ 9.0 Compilers. These compilers allow you to target x86, x64, IA64 processor architectures."
3. To verify that you have all installed components, check that the Microsoft SDK contains the "amd64" version of the C/C++ compiler "cl.exe". This is usually installed into
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe
4. At this point you should be able to proceed and compile code as usual.
For example, to select the compiler and build the YPRIME.C example MEX-file,
mex -setup % Select Visual Studio 2008 Express Edition
copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'))
mex -v yprime.c
yprime(1,1:4)
The final line should execute the MEX-file, and calculate the following output:
ans =
2.0000 8.9685 4.0000 -1.0947
If you are unable to select your compiler, compile the MEX-file, or execute the MEX-file, consult the Troubleshooting section below.
5. Troubleshooting
If the "x64 Compilers and Tools" are not installed properly, MATLAB might display one of the following messages:
*****************************************************************************
Error: Could not find the 64-bit compiler. This may indicate that the
"X64 Compilers and Tools" or the Microsoft Windows Software
Development Kit (SDK) is not installed. To build 64-bit MEX-files
Microsoft Visual C++ 2008 Express Edition requires that these two
packages are installed properly.
*****************************************************************************
*****************************************************************************
Error: Could not find the Microsoft Windows Software Development Kit (SDK).
This may indicate that the Microsoft Windows SDK or the
"X64 Compilers and Tools" is not installed. To build 64-bit
MEX-files Microsoft Visual C++ 2008 Express Edition requires that
these two packages are installed properly.
*****************************************************************************
If you see these messages, you may not have the SDK or x64 Compilers and Tools installed properly, or MATLAB may not be able to locate them on your system. Verify that you have installed these packages as described above. For additional assistance, contact MathWorks Technical Support.
For information on which MathWorks products support Visual Studio 2008 Express Edition in your release, see the Supported Compiler List:
0 Comments
More Answers (0)
See Also
Categories
Find more on C Shared Library Integration 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!