I am trying to use C MEX API functions in my S-Function, but I am getting undefined reference compile errors when I don't include 'mex.h", and redefinition compile errors when I include "mex.h". I see that the required "simstruc.h" does include "mex.h". What is causing these errors and how can I use these functions in generated code?
MATLAB: Can I use C MEX Functions such as ‘mxPutVariable’ in an S-Function and then generate code
%sapiccoderfunctionmexmexputvariables-functionsimulinksimulink coder
Related Question
- Do I get an error when trying to MEX Fortran functions
- How to use “mexPrintf” for simulation and “printf” for code generation in a MATLAB Function Block using coder.ceval
- Do I get a compile error when generating code for an automatically generated S-Function
- Am I unable to use the PRINTF function from the standard C libraries inside the wrapper code of the C-MEX S-function
- Is MATLAB R2017a unable to locate build file with a “NMAKE : fatal error U1052: file ‘MODELNAME.mk’ not found” error when using Visual Studio 2017
- How to print text to the MATLAB command window from a FORTRAN MEX file
- Do I get an error when I use the S-Function builder in 64-bit Simulink with the Windows SDK 7.1 Compiler
- How to add a C header file to the C-Mex S-function
Best Answer