MATLAB no longer supports user-defined MEX configuration?

人盡茶涼 提交于 2019-12-05 08:54:59

It seems that the following command works:

mex -setup my_mexopts.sh

however, there's some warning information,

Legacy MEX infrastructure is provided for compatibility; it will be removed in a future version of MATLAB.

Apart from that, everything looks fine, except I got some warning at compile time seems due to compiler version(gcc 4.9.1) on my current system(OS X 10.10).

gcc: warning: couldn't understand kern.osversion '14.0.0

When I run mex -setup C, I see information like the following:

Microsoft Visual C++ 2008 (C)  mex -setup:H:\MATLAB\R2014b\bin\win64\mexopts\msvc2008.xml C
Microsoft Visual C++ 2010 (C)  mex -setup:H:\MATLAB\R2014b\bin\win64\mexopts\msvc2010.xml C
Microsoft Visual C++ 2012 (C)  mex -setup:H:\MATLAB\R2014b\bin\win64\mexopts\msvc2012.xml C

The mex part is actually a link you can click to choose that configuration. So, to make your own:

  1. Choose an xml as a template and copy it. (e.g I'd copy H:\MATLAB\R2014b\bin\win64\mexopts\msvc2012.xml to %AppData%\MathWorks\MATLAB\R2014b\mex_C++_win64_custom.xml).
  2. Make the edits in the XML file, probably in the <vars> tag (e.g. modify COMPFLAGS or CFLAGS whatever variable has your compiler options) or the <env> tag (e.g. PATH, INCLUDE, LIB, etc.)
  3. Set that to the current configuration:

    mex -setup:C:\[YourMATLABAppDataHere]\myCopts.xml C
    

Note that a good place in Windows to keep settings is under %APPDATA%. For MATLAB R2014b, this would be something like C:\Users\[yourname]\AppData\Roaming\MathWorks\MATLAB\R2014b.

Do the same for C++ or FORTRAN configurations too.

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