user2966224
user2966224

Reputation: 63

Build a mex file under Visual Studio ultimate 2012

I had some code (c++) and I would like to generate the mex files.

is there any tutorial which tech how to setup visual studio ultimate 2012 how to build mex files?

thanks a lot

Upvotes: 2

Views: 978

Answers (1)

j0rre
j0rre

Reputation: 529

I can confirm that the same steps as described in this question work for Visual Studio 2012 (and for Visual Studio 2013 too). Starting with an empty project the following settings in the project's Property Pages are necessary and sufficient to build a working .mexw64 file:

Configuration properties -> General:
    Set Target Extension to .mexw64
    Set Configuration Type to Dynamic Library (.dll)

Configureation poperties -> VC++ Directories:
    Add $(MATLAB_ROOT)\extern\include; to Include Directories

Configuration properties -> Linker -> General:
    Add $(MATLAB_ROOT)\extern\lib\win64\microsoft; to Additional Library Directories

Configuration properties -> Linker -> Input:
    Add libmx.lib;libmex.lib;libmat.lib; to Additional Dependencies

Configuration properties -> Linker -> Command Line:
    Add /export:mexFunction to Additional Options

$(MATLAB_ROOT) is the path to Matlab's root folder, eg. C:\Program Files\MATLAB\R2014a. For a 32-bit build you'd need to change both occurrences of 64 to 32.

Upvotes: 2

Related Questions