import Simulink code into code composer studio

조회 수: 3 (최근 30일)
Gaston Melo
Gaston Melo 2020년 5월 14일
답변: Vidip 2024년 6월 7일
I to all, I have a simulink model with an S-Function Builder (include header files and some code). I was able to generate the C dode using Simulink coder (it generate the wrapper.c - tlc - c files).
What I want now is to import this file into CCS but when I tried to compile using CCS i got the error shown bellow. How can I solve this?:
#error directive: Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE .ccsproject /Matlab_simulink_project line 316, external location: /home/gaston/.local/MATLAB/R2020a/simulink/include/simstruc_compcond.h C/C++ Problem

답변 (1개)

Vidip
Vidip 2024년 6월 7일
The error message you're encountering, 'Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE', typically occurs during the compilation of MATLAB MEX files or Simulink models that interface with C/C++ code.
This issue has several possible root causes. Here are some troubleshooting steps you can try to find the root cause of the issue:
  1. If an S-Function has TLC inlining files, then the "S-function modules" parameter in the S-Function block should be left blank. Setting the "S-function modules" parameter to the name of MEX source code for the S-Function introduces non-inline MEX source code into the build process. This results in an error message because the build process recognizes that the S-Functions were inline with TLC, so it doesn't include the -DRT on the compile line.
  2. If the C/C++ MEX S-Function file contain the ‘#define MATLAB_MEX_FILE’ preprocessor directive, then this directive should be removed from the C/C++ MEX S-Function file. The definition will automatically be included in the compiler arguments when the MEX file is built. For information on creating a C MEX S-Function, refer to the following documentation page: https://in.mathworks.com/help/simulink/sfg/example-of-a-basic-c-mex-s-function.html
  3. If you are attempting to build the code in an external IDE and receiving these error messages, then try to ensure the required defines are set properly. You can find the required defines in the text file in your model's code generation directory. Check to see if any compiler flags (for example, RT or USE_RTMODEL) should be added to the external IDE and verify that the following folder is included by the external IDE: <matlabroot>\extern\include

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by