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

조회 수: 6 (최근 30일)
Jack
Jack 2015년 5월 11일
편집: Walter Roberson 2015년 5월 16일
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

답변 (1개)

Sainath Varikuti
Sainath Varikuti 2015년 5월 13일
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''})');

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by