matlabmex

Matlab deployement tool, Microsoft compiler


I'd like to know which specific file is my Microsoft compiler. I need it to compile some Matlab code. By running mex -setup mex is able to locate the compiler in the following directory : d:\Program Files (x86)\Microsoft Visual Studio 10.0 However when I browse there, there is no file that would possibly be the actual compiler. I'd like to build my application, but it won't work, looks like Matlab indeed found the compiler, but I get an error (code = 53) An error occurred while shelling out to mbuild So my guess then was that I had to go in the Deployement tool Settings and add some options like the compiler directory (even if I already set it with mex), but I can't find it in d:\Program Files (x86)\Microsoft Visual Studio 10.0 I don't even know what's the compiler's name. I really need help on this one. Thanks!


Solution

  • For mex -setup to work correctly you don't need to know what the actual compiler is called. When I run mex -setup I get a list like this:

    Select a compiler: 
    [1] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) in C:\Program Files (x86)\Intel\ComposerXE-2011 
    [2] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) in C:\Program Files (x86)\Intel\ComposerXE-2011 
    [3] Microsoft Visual C++ 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.0 
    
    [0] None 
    

    and if I select [3] the informative output includes the lines

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

    If you inspect either of those files you will find the name of the compiler (it's called cl.exe and there are a few different versions in directories below the one that Matlab suggests it is looking in) assigned to be the value of a script variable called COMPILER. You'll also find all the settings that mex uses when it compiles code into a mex-file. You may be able to diagnose the rest of your problem(s) from this information.

    If you can't solve your problem(s) with this 'help', edit it and explain precisely the error messages and