MATLAB Answers


How to prompt Matlab to use VS10 64 bit compiler

Asked by Donald Hume on 8 Feb 2013

Hello all. I am trying to compile and run a 64bit application in MATLAB using the Visual Studio 2010 Professional compiler. I know both the program and the compiler work properly because when I start matlab from the Visual Studio x64 command prompt I am able to run the program without an issue.

I have run mex -setup and selected the 2010 compile as follows:

>> mex -setup Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? y

Select a compiler: [1] Microsoft Visual C++ 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.0 [2] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0

[0] None

Compiler: 1

Please verify your choices:

Compiler: Microsoft Visual C++ 2010 Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0

Are these correct [y]/n? y

************************************************************************* Warning: MEX-files generated using Microsoft Visual C++ 2010 require that Microsoft Visual Studio 2010 run-time libraries be available on the computer they are run on. If you plan to redistribute your MEX-files to other MATLAB users, be sure that they have the run-time libraries. *************************************************************************

Trying to update options file: C:\Users\OEM\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mexopts\msvc100opts.bat

Done . . .

Unfortunately this doesn't seem to allow me to run the 64bit application. I get an error regarding cl preprocessor commands, essential pointing to the fact I'm not using a 64 bit compiler. Does anyone know how I can configure this so that I will not need to run Matlab from the Visual Studio 2010 command line? I would appreciate any help on this, and have read countless MATLAB Central articles.

Thanks so much in advance!



Have you installed the x64 Compilers and Tools package with Visual Studio? Also, try running mex -setup after starting MATLAB in a regular command prompt. This will ensure that your system PATH variable is correctly setup.

Donald: Could you please the exact compiler error message that you see?

Log in to comment.

0 Answers

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!