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.)
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"
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"
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
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
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.
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
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 :-(
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.
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' ?
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.
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";
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
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'.
30 Sep 2008
Alexander Pastukhov
Thanks a lot! Worked perfectly with Windows XP SP 3 and Matlab v7.5.0!
29 Sep 2008
Paris Kaimakis
Many thanks Vakur, I found your post and attached .zip very helpful!
28 Sep 2008
Liuqing Yang
the matlab2007 didn't have the extern lib for the vs2008(msvc90)
29 Aug 2008
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.
18 Aug 2008
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.
29 Jun 2008
Stefan Atev
Worked without issues
30 May 2008
Bruno Carozza
Thanks a bunch!! Working perfectly
15 May 2008
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
14 May 2008
IWBT TUBS
just what we seem to need
18 Mar 2008
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 !!!
27 Feb 2008
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.
27 Feb 2008
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.
Basically the trick is to force the mex to use the 64-bit compilers and libraries.
23 Feb 2008
ivan scardanzan
does not seem to work under win xp 64
22 Feb 2008
Eric Tsai
Windows 2003 X86/X64 with SP2 tested.
21 Feb 2008
Andre Pfeuffer
Only standard and professional versions of Visual Studio 2008 can handle AMD64
21 Feb 2008
Armado Torres
It cannot compile x64 mex files...
useless
20 Feb 2008
Tiago da Silva
I love you
18 Feb 2008
Rainer Betrug
Thank's!
works perfect with XP and Matlab2007b
17 Feb 2008
Itzik Pinhas
Works perfectly.
Thank you very much.
11 Feb 2008
Tsen Yao Peng
Does not work Vista 64 Matlab 2007
11 Feb 2008
Nhan Tien Cao
works perfectly, you are pro, thank you very much!
11 Feb 2008
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.
07 Feb 2008
Ali Sinop
Works perfect under XP. Thanks a lot.
31 Jan 2008
Vakur VEZIR
Hi everyone,
Is there someone tried this on XP operating system? Please comment if so.
You are all welcome!
31 Jan 2008
Pablo Sala
Very helpful. Thank you very much!
30 Jan 2008
Dimitri Shvorob
Thanks a lot! (Is there a way to make 'mbuild -setup' see VS 2008 too?)