How to link additional libraries when compiling Matlab/Simulink S-function via 'mex'
When you compile a Matlab or Simulink S-Function using mex
, you might need to link additional libraries. This is especially common when using external libraries such as OpenCV, Boost, or Eigen.
To link additional libraries when compiling a Matlab or Simulink S-Function via mex
, you can use the -l
flag followed by the library name. For example, to link the OpenCV library, you can use the following command:
mex -lopencv_core -lopencv_highgui myfunction.cpp