C1189: #error : Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
20 次查看(过去 30 天)
显示 更早的评论
Hello ,
I use ert.tlc to get c and h files for visual studio 2017. Everthing was good until ı got this error --->>> C1189: #error : Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
Any idea to fix this error.
Thanks
回答(2 个)
Juan
2024-1-26
I have the same problem. You could solve it?
In file included from C:/Program Files/MATLAB/R2022a/simulink/include/simstruc.h:64:0,
C:/Program Files/MATLAB/R2022a/simulink/include/simstruc_compcond.h:330:2: error: #error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
#error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
^~~~~
In file included from C:/Program Files/MATLAB/R2022a/simulink/include/simstruc_compcond.h:463:0,
from C:/Program Files/MATLAB/R2022a/simulink/include/simstruc.h:64,
C:/Program Files/MATLAB/R2022a/rtw/c/src/rt_matrx.h:197:60: error: unknown type name 'mwSize'
extern mxArray *rt_mxCreateNumericArray(int_T ndims, const mwSize *dims,
^~~~~~
C:/Program Files/MATLAB/R2022a/rtw/c/src/rt_matrx.h:205:14: error: unknown type name 'mwSize'
extern const mwSize *rt_mxGetDimensions(const mxArray *pa);
^~~~~~
Vidip
2024-6-7
The error message you're encountering, fatal error C1189: #error: 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:
- 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.
- 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
- 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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Code Generation for Custom Blocks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!