File Exchange

image thumbnail

Microsoft Visual Studio 2008 Mex and Mbuild Setup Files

version 1.0 (21.8 KB) by

Use these files to compile mex files from matlab command prompt with Visual Studio 2008

4.38235
36 Ratings

5 Downloads

Updated

No License

I installed Microsoft Visual Studio(MVS) 2008 and Matlab R2007b and tried "mex -setup" command from Matlab. However my MVS 2008 was not recognized by Matlab. I debugged mex.m and found a way to show MVS 2008 to Matlab. Necessary files are located at 2 different directories in zip file (VS2008MATLABMexCompilerFilesX64 and VS2008MATLABMexCompilerFilesX86), one is for win32 Operating System(OS) and the other one is for win64 OS. There is also "directory.txt" file in the zip which shows the directory that you should copy necessary files to. I'm using VISTA ultimate edition, but this may work for other OS(not tested). Simply copy 6 files in one of these directories(depend on your OS) to the directory specified in directory.txt and try "mex -setup" again. (Procedure for mbuild is similar to this one.)

Comments and Ratings (52)

please ignore previous post, meant for other matlab forum! oppps

When I run any of face tracking test files, just the camera projection appears (nothing additional). In the png attached it seems like red tracking dots should be overlayed. Can someone help? I want to view facial tracking information.

Zhu Xiaofeng

Does not work in win7 64bit. The files in folder *X86 *X64 are the same, which is all for x86 not x64, so may be there is a careless mistake
However, the files in http://www.mathworks.com/matlabcentral/fileexchange/22689 works, as the submissioner suggest the link.

It is important that users should take care of the outputs when doing "mex -setup" in matlab. Sometime, the outputs tells that mex is using "msvc90opts.bat". At this time, users should delete "msvc90opts.bat msvc90opts.stp" in "C:\Program Files\MATLAB\R2009b\bin\win64\mexopts", which make mex only use "msvc90freeopts.stp msvc90freeopts.bat", because files--"msvc90freeopts.bat msvc90freeopts.bat.stp" are correct but "msvc90opts.bat msvc90opts.stp" are wrong in the submission--"http://www.mathworks.com/matlabcentral/fileexchange/22689"

Thank you very much any way.

Zhu Xiaofeng

Does not work in win7 64bit. The files in folder *X86 *X64 are the same, which is all for x86 not x64, so may be there is a careless mistake
However, the files in http://www.mathworks.com/matlabcentral/fileexchange/22689 works, as the submissioner suggest the link.

It is important that users should take care of the outputs when doing "mex -setup" in matlab. Sometime, the outputs tells that mex is using "msvc90opts.bat". At this time, users should delete "msvc90opts.bat msvc90opts.stp" in "C:\Program Files\MATLAB\R2009b\bin\win64\mexopts", which make mex only use "msvc90freeopts.stp msvc90freeopts.bat", because files--"msvc90freeopts.bat msvc90freeopts.bat.stp" are correct but "msvc90opts.bat msvc90opts.stp" are wrong in the submission--"http://www.mathworks.com/matlabcentral/fileexchange/22689"

Thank you very much any way.

vj

vj (view profile)

Martin

Martin (view profile)

Very handy. Thanks.

study

study (view profile)

I have quite the same problem with Nelson. I used:
MATLAB 2009b
win7 (64-bit)
Visual Studio Pro 2008
whatever I tried still cannot deploy the created DLLs from MATLAB Compiler.
Is it caused by my installation?
@Sean Ma: I wonder if your system can work with MATLAB 2009b

Sean Ma

Works on Matlab R2007a + Visual Studio Pro 2008 on Win 7 64 bit, great job!

Nanqing

Good

Venkatesh

Awesome job

Audrey

Audrey (view profile)

My system :

Win XP ( 32 bit)
Matlab 2006b
Visual Studio 2008 Pro

I have no problem to compile the mex function, when I call the mexfunction, I got error:

??? Invalid MEX-file xxxx.mexw32 : The specified module could not be found.

Do you have any idea ?

Thanks a lot

vernor Chen

Good! It solved the problem bothering me for two days!

It works with XP

Nelson

Nelson (view profile)

Hi there
I use matlab 2009b an VS 2008, i tried your files but it does not works,
when i attached the matlab proccess to VS, it shows some infractions to access from the matlab, and exceptions, i dont know if the problem is the installation of Matlab or VS, or my windows is XP sp3

Thans for your help

Alex

Alex (view profile)

this is in the right direction -- At least matlab recognized I have VS installed now -- it just doesn't use it correctly. 64-bit files clearly have some 32-bit hangover incosistencies, such as the target architecture. I'm going through comparing to the similar file aready installed in my 2009b installation and looking for what matlab is missing that you did right.

Alex

Alex (view profile)

Seongjoo Lee

It worked! Thank you.

Daniel Wright

I get the following error when I use mbuild -setup:

Undefined subroutine &mexsetup::correct_version called at C:\MATLAB701\BIN\WIN32\mbuildopts\msvc90compp.stp line 26, <STDIN> chunk 1.
??? Error using ==> mbuild
Unable to complete successfully

I see that 2 others have had the same issue. Any suggestions are welcome; please send me an email. I am using Matlab 7.0.1 (R14) in Windows XP on an x86 machine

Carlos G-M

Doesn't work at x64 Vista Business, Matlab R2007b and MS Visual Studio 2008. I tried with mex-setup but was not recognized by Matlab. The installation is OK but and the end you can't use the compiler :-(

cool thanx

Amaren

Amaren (view profile)

i am getting the following error when i use mex - setup and then respond 'y'. what may be the reson. Please help
the error is
Undefined subroutine &mexsetup::correct_version called at C:\MATLAB7\BIN\WIN32\mexopts\msvc90opts.stp line 25, <STDIN> chunk 1.

mklml

mklml (view profile)

hi woudl you also have ideas on how I can associate the link files ? I have downloaded MVS2008 and used your files to install it. I want to instal an Intel fortran compiler and it keeps requesting the 'Microsoft Visual C++ 2005 linker' ?

Larry Baker

Larry Baker (view profile)

We were unable to use the files here with Microsoft Visual C++ 2008 Express. I have uploaded our support files for 32/64-bit Microsoft Visual C++ 2008 Express with the latest Windows Platform SDK are at http://www.mathworks.com/matlabcentral/fileexchange/22689.

Wang Tianhui

Wang Tianhui (view profile)

I installed VC2008 in path "D:\programs\" and mex reported cannot-find-cl.exe error when I mex my cpp files after following the instructions provided by this article. But it works after I made the following changes:

in file msvc90opts.stp (Revision: 1.1.10.2):
change the line --
my $default_location = "C:\\Program Files\\Microsoft Visual Studio 9.0";
to my vc installed path --
my $default_location = "D:\\Programs\\Microsoft Visual Studio 9.0";

Hi,

I copied the files, and when I choose Visual C++ 2008 version, I get this error.

Please can any tell me what would be the problem?

Undefined subroutine &mexsetup::correct_version called at C:\MATLAB701\BIN\WIN32\mexopts\msvc90opts.stp line 25, <STDIN> chunk 2.
??? Error using ==> mex
Unable to complete successfully

Thanks,
Sharsch

Hauke Heibel

Anyways... thumbs up! :)

Hauke Heibel

Quite nice work so far! Unfortunately there is kinda big show stopper if you would want to compile with debug information (-g). Actually you really need to add /MDd to the DEBUGFLAGS in the msvc90compp.bat and in the msvc90opts.bat. In case these flags are missing your Matlab may completely crash. Once the files are changed, you need to re-run 'mex -setup'.

Alexander Pastukhov

Thanks a lot! Worked perfectly with Windows XP SP 3 and Matlab v7.5.0!

Paris Kaimakis

Many thanks Vakur, I found your post and attached .zip very helpful!

Liuqing Yang

the matlab2007 didn't have the extern lib for the vs2008(msvc90)

Sudarshan Dayanidhi

Thanks!!! Recognition worked like a charm. However one still needs to have Windows SDK installed and the environment variable MSSDK set so that the compiler can actually work.

Leos Junek

Does not work at x64 Vista Ultimate & Matlab 2007a & MS Visual Studio Pro 2008(ver. 9.0). Causing same error as described on 2008-02-11 by Erik Von Wurstelberg.

Stefan Atev

Worked without issues

Bruno Carozza

Thanks a bunch!! Working perfectly

Frustrated User

I had tried to fool Matlab in to beliving that VS 9.0 was VS 8.0 and only got 1/2 way there.

I installed these files and it worked like a charm. Thanks

IWBT TUBS

just what we seem to need

sqhbrd hbtjv

I have :
matlab 7.4.0 (R2007a)
& microsoft visual studio 2008 pro edition (9.0)
Simple, and it's working.
Thanks a lot !!!

Nirmal Jayaram

Does someone know how to get MATLAB R2007b to recognize Visual studio 2008 for Windows xp64? The procedures suggested by Vakur VEZIR and Dean Fang don't seem to work as such.

Dean Fang

I wrote a document to describe how to adapt this for compiling 64-bit Matlab mex files using Visual Studio 2008. Please find it on our lab wiki and let me know how that works for you.

http://comkat.case.edu/comkat/comkat_wiki/index.php?title=Support:Tech_notes

Basically the trick is to force the mex to use the 64-bit compilers and libraries.

ivan scardanzan

does not seem to work under win xp 64

Eric Tsai

Windows 2003 X86/X64 with SP2 tested.

Andre Pfeuffer

Only standard and professional versions of Visual Studio 2008 can handle AMD64

Armado Torres

It cannot compile x64 mex files...
useless

Tiago da Silva

I love you

Rainer Betrug

Thank's!
works perfect with XP and Matlab2007b

Itzik Pinhas

Works perfectly.
Thank you very much.

Tsen Yao Peng

Does not work Vista 64 Matlab 2007

Nhan Tien Cao

works perfectly, you are pro, thank you very much!

Erik Von Wurstelberg

it does not work with
vista business x64
MVS 2008
R2007b
installation is ok
compiling give the following error message
C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL:
Error: Using options file:
C:\Users\Nataste\AppData\Roaming\MathWorks\MATLAB\R2007b\mexopts.bat
You cannot use this file with the WIN64 architecture because it enables
a compiler for a different architecture.
Running mex -setup may resolve this problem.

Ali Sinop

Works perfect under XP. Thanks a lot.

Vakur VEZIR

Hi everyone,
Is there someone tried this on XP operating system? Please comment if so.
You are all welcome!

Pablo Sala

Very helpful. Thank you very much!

Dimitri Shvorob

Thanks a lot! (Is there a way to make 'mbuild -setup' see VS 2008 too?)

Updates

mbuild files are added.

To explain submission better!

MATLAB Release
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today