If the. c file is not dependent on any third-party libraries, then the MEX compilation is simple and only needs to be entered in the MATLAB command line
Mex test.c can be.
However, if the C file uses third-party library files, such as OpenCV, GSL and so on, then you need to change the MEX compilation options, otherwise it will be reported fetal error C1083, can not find including files.
It is important to note that before the MEX, you need to use the mex-setup to select the compiler, if I choose VS2012, then I need to add the corresponding option to VS2012 the corresponding opt file, the specific location in
' Matlab path \r2013a\bin\win64\mexopts ' below,
VS2012 the corresponding file is Msvc110opts.bat.
After opening this file, locate the set include= and set lib= two lines, add the Inclue path and the LIB path of the library used to each of these two lines.
Once saved, you will need to re-use Mex-setup to select the compiler for the changes to take effect.
There may be a better way to continue exploring the settings that depend on the location of the library.
MATLAB and C language mixed programming, including directory settings