Matlab2014a使用VS2015混合编译
matlab的版本要到2015b才支持vs2015,然而自己电脑上用的matlab2014a,和VS2015社区版,不想重新安装,需要替换其mexopts文件夹,估计就类似于一个mex的Makefile文件,路径为R2014a\bin\win64\mexopts。下载之,替换即可。mexopts文件夹的下载地址为 http://pan.baidu.com/s/1o8hR926 ,之后做以下步骤编译即可。
>> mex -setup
MEX 配置为使用 'Microsoft Visual C++ 2015 Professional (C)' 以进行 C 语言编译。
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
要选择不同的语言,请从以下选项中选择一种命令:
mex -setup C++
mex -setup FORTRAN
>> mex -setup C++
MEX 配置为使用 'Microsoft Visual C++ 2015 Professional' 以进行 C++ 语言编译。
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
>> mex -v yourfile.cpp