Build a mex file under Visual Studio ultimate 2012

穿精又带淫゛_ 提交于 2020-02-02 11:42:52

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/21189832/build-a-mex-file-under-visual-studio-ultimate-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!