How do I run the C code generated fomr a simulink model that contains S function

2 views (last 30 days)
I am working on C code generation from Simulink model. Some subsystems of the model were built using S function. After I generate code from the modle with "non-inlined S function" checked, I passed the "model check" and successfully generated the C code (matlab2014a 32bit). However, when I collect all the .c and .h file and try to run in Dev C++. I always got the error message :
"error Unrecognized use.",
"error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE" ,
"[Error] unknown type name 'mxArray'"and "[Error] unknown type name 'RTWSfcnInfo'".
It seems the simstruc.h must be included as required from the generated C code, but it is conflicting with some files. Is there any solution to this problem, such that I can run the generated C code. I tried the case without S function , everything was as expected

Answers (1)

Sainath Varikuti
Sainath Varikuti on 13 May 2015
It is possible that dependent header files are missing during compilation. Use pack and go functionality to package all the necessary files and dependents by using the following command before compiling it in external IDE.
set_param(your_model, 'PostCodeGenCommand','packNGo(buildInfo, {''packType'' ''hierarchical''})');

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!