compatibility of MEX TYPE for Matlab 2007b and visual studio 2008

when i type "mex-setup and then i get Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2007b\sys\lcc
[0] None
after pressing "y", how i can connect c++ to matlab,thanks

 Accepted Answer

LCC is a C compiler only, not a C/C++ compiler combo like Visual Studio et al. To get C++ you have to install a separate C++ compiler that is supported by your version of MATLAB, e.g. from the list here:
Microsoft Visual C++ 2005 Express is listed on the page for 32-bit Windows MATLAB, so you could install that one.
Another option that sometimes works is to copy the mex support files from a later version of MATLAB (do you have any?) to the appropriate directories in your older version of MATLAB. E.g., in your case you might need to locate the files from R2008a or R2008b that support MSVC 2008 and copy them to your R2007b directories.

3 Comments

i am using visual studio 2008 and matlab 2007b, can you send me the name of directries i should install?the link you suggest to me have different files, which one i should download ?now i get this options.
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2007b\sys\lcc
[2] Microsoft Visual C++ 2008 in C:\Program Files\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Lcc-win32 C 2.4.1
Location: C:\PROGRA~1\MATLAB\R2007b\sys\lcc
Are these correct?([y]/n): y
Trying to update options file: C:\Users\Faiz\AppData\Roaming\MathWorks\MATLAB\R2007b\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2007b\bin\win32\mexopts\lccopts.bat
Done . . .
>> helloworld.cpp
Undefined variable "helloworld" or class "helloworld.cpp".
>>
i downloaded vs 2005 too but still in vs iget the same result "1>c:\users\faiz\documents\visual studio 2005\projects\helloworld\helloworld\helloworld.cpp(3) : fatal error C1083: Cannot open include file: 'mex.h': No such file or directory "
1) Select [2] (MSVC 2008) from the list, not [1] (Lcc).
2) Issue the mex command, don't just type in the file name. E.g.,
>> mex helloworld.cpp

Sign in to comment.

More Answers (0)

Categories

Asked:

on 26 Jul 2016

Commented:

on 27 Jul 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!