Got Questions? Get 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

Thread Subject:
mex -setup does not find my c++ compilier

Subject: mex -setup does not find my c++ compilier

From: Colin Barnhill

Date: 6 Mar, 2009 16:17:01

Message: 1 of 3

I just installed visual studio c++ express on my Windows xp32 (I think it is 32. How do I check?) computer. When I run mex -setup, it only finds the built in C compiler.

Do I need to set a path to the C++ compiler?
Do I need to run the compiler once?

Subject: mex -setup does not find my c++ compilier

From: Colin Barnhill

Date: 6 Mar, 2009 17:29:02

Message: 2 of 3

I have now tried this:

>> mex -setup
Please choose your compiler for building external interface (MEX) files:
 
Would you like mex to locate installed compilers [y]/n? n
 
Select a compiler:
[1] Borland C++Builder version 6.0
[2] Borland C++Builder version 5.0
[3] Borland C/C++ (free command line tools) version 5.5
[4] Compaq Visual Fortran version 6.1
[5] Compaq Visual Fortran version 6.6
[6] Intel Visual Fortran version 9.0
[7] Lcc C version 2.4.1
[8] Microsoft Visual C/C++ version 8.0
[9] Microsoft Visual C/C++ version 7.1
[10] Microsoft Visual C/C++ version 6.0
[11] Open WATCOM C/C++ version 1.3
 
[0] None
 
Compiler: 8
 
The default location for Microsoft Visual C/C++ compilers is C:\Program Files\Microsoft Visual Studio 8,
but that directory does not exist on this machine.
 
Use C:\Program Files\Microsoft Visual Studio 8 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio 8] C:\Program Files\Microsoft Visual Studio 9.0\
 
Please verify your choices:
 
Compiler: Microsoft Visual C/C++ 8.0
Location: C:\Program Files\Microsoft Visual Studio 9.0\
 
Are these correct?([y]/n): y
 
***************************************************************************
  Warning: MEX-files generated using Microsoft Visual C++ 8.0 require
           that Microsoft Visual Studio 2005 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.
           You can find more information about this at:
           http://www.mathworks.com/support/solutions/data/1-2223MW.html
***************************************************************************
 
Trying to update options file: C:\Documents and Settings\Test\Application Data\MathWorks\MATLAB\R2006a\mexopts.bat
From template: C:\PROGRAM FILES\MATLAB\R2006A\BIN\win32\mexopts\msvc80opts.bat
 
Done . . .
 
***************************************************************************
  Warning: The file extension of 32-bit Windows MEX-files was changed
           from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated
           MEX-file will not be found by MATLAB versions prior to 7.1.
           Use the -output option with the ".dll" file extension to
           generate a MEX-file that can be called in previous versions.
           For more information see:
           MATLAB 7.1 Release Notes, New File Extension for MEX-Files on Windows
***************************************************************************
 
>> 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] Lcc C version 2.4.1 in C:\PROGRAM FILES\MATLAB\R2006A\sys\lcc
 
[0] None
 
Compiler:

As you can see it still won't let me choose the C++ compiler.

Any thoughts?

Subject: mex -setup does not find my c++ compilier

From: James Tursa

Date: 6 Mar, 2009 19:17:02

Message: 3 of 3

"Colin Barnhill" <shaolin_cb@yahoo.com> wrote in message <gormgu$8d2$1@fred.mathworks.com>...
> I have now tried this:
>
> >> mex -setup
> Please choose your compiler for building external interface (MEX) files:
>
> Would you like mex to locate installed compilers [y]/n? n
>
> Select a compiler:
> [1] Borland C++Builder version 6.0
> [2] Borland C++Builder version 5.0
> [3] Borland C/C++ (free command line tools) version 5.5
> [4] Compaq Visual Fortran version 6.1
> [5] Compaq Visual Fortran version 6.6
> [6] Intel Visual Fortran version 9.0
> [7] Lcc C version 2.4.1
> [8] Microsoft Visual C/C++ version 8.0
> [9] Microsoft Visual C/C++ version 7.1
> [10] Microsoft Visual C/C++ version 6.0
> [11] Open WATCOM C/C++ version 1.3
>
> [0] None
>
> Compiler: 8
>
> The default location for Microsoft Visual C/C++ compilers is C:\Program Files\Microsoft Visual Studio 8,
> but that directory does not exist on this machine.
>
> Use C:\Program Files\Microsoft Visual Studio 8 anyway [y]/n? n
> Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio 8] C:\Program Files\Microsoft Visual Studio 9.0\
>
> Please verify your choices:
>
> Compiler: Microsoft Visual C/C++ 8.0
> Location: C:\Program Files\Microsoft Visual Studio 9.0\
>
> Are these correct?([y]/n): y
>
> ***************************************************************************
> Warning: MEX-files generated using Microsoft Visual C++ 8.0 require
> that Microsoft Visual Studio 2005 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.
> You can find more information about this at:
> http://www.mathworks.com/support/solutions/data/1-2223MW.html
> ***************************************************************************
>
> Trying to update options file: C:\Documents and Settings\Test\Application Data\MathWorks\MATLAB\R2006a\mexopts.bat
> From template: C:\PROGRAM FILES\MATLAB\R2006A\BIN\win32\mexopts\msvc80opts.bat
>
> Done . . .
>
> ***************************************************************************
> Warning: The file extension of 32-bit Windows MEX-files was changed
> from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated
> MEX-file will not be found by MATLAB versions prior to 7.1.
> Use the -output option with the ".dll" file extension to
> generate a MEX-file that can be called in previous versions.
> For more information see:
> MATLAB 7.1 Release Notes, New File Extension for MEX-Files on Windows
> ***************************************************************************
>
> >> 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] Lcc C version 2.4.1 in C:\PROGRAM FILES\MATLAB\R2006A\sys\lcc
>
> [0] None
>
> Compiler:
>
> As you can see it still won't let me choose the C++ compiler.
>
> Any thoughts?

The mex command cannot find your compiler, so you picked the compiler and directory manually, but then never tried to use it. Have you actually tried to use it? i.e., only do mex -setup once and do the manual stuff shown above, and then try to use it and see what happens. If mex -setup cannot find it once, it will never find it, so don't worry about that for now. Just do the manual stuff and then try to use it. But it looks like you are using option files for VC8 whereas your actual compiler is VC9. So the compiler name may be different and it still may not work. So you might want to check out this FEX submission:

http://www.mathworks.com/matlabcentral/fileexchange/18508

James Tursa

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us