在Visual Studio Ultimate 2012下生成一个mex文件 [英] Build a mex file under Visual Studio ultimate 2012
问题描述
我有一些代码(c ++),我想生成mex文件.
I had some code (c++) and I would like to generate the mex files.
是否有任何教程介绍了如何设置Visual Studio Ultimate 2012以及如何构建mex文件的技术?
is there any tutorial which tech how to setup visual studio ultimate 2012 how to build mex files?
非常感谢
推荐答案
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)
是Matlab根文件夹的路径,例如. C:\ Program Files \ MATLAB \ R2014a.对于32位版本,您需要将两次出现的次数都更改为64到32.
$(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.
这篇关于在Visual Studio Ultimate 2012下生成一个mex文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!