How to specify C++ version when compiling Matlab/Simulink S-function using 'mex'
In order to specify the C++ version when compiling a Matlab or Simulink S-Function using mex
, you need to specify the CXXFLAGS
.
Here’s an example for GCC. Remember to always add -fPIC
to the flags, as this is required for Matlab to load the compiled library.
mex CXXFLAGS="-fPIC -std=gnu++17" -lzmq mysfunction.cpp