It turned out that the tool I was integrating, which was developed by someone else in Matlab and converted into C++ with the coder, included a "rtwtypes.h" file. Because the tool was developed in a newer version of Matlab (2016 vs 2013), it was the root of a lot of redefinition errors and unrecognized types. After replacing it with the 2013 version of "rtwtypes.h" and adding in defines for "TRUE" and "FALSE", everything finallaly compiled together and worked. Last problem is that the PWork vector seems to lose its functionality if external libraries are used during compilation, and stranger still, external library static variables only persist for a single major time step in Simulink, so there's no easy workarounds.
Compile Model Reference with S-function & TLC
7 次查看(过去 30 天)
显示 更早的评论
Thomas Satterly Satterly
2019-4-24
回答: Thomas Satterly Satterly
2019-4-25
I have a working S-function that I can mex for use in normal mode and a TLC file that successfully compiles and runs in accelerator mode. However, when trying to use the S-function in an accelerated reference model or a standalone model in rapid accelerator mode, compilation fails. The errors started with redefinition errors, mainly in "matrix.h" vs. "rt_matrix". If I force the use of strictly matrix.h, the compiler seems to not know of the "bool" type in the files "slMdlrefSfcnBridge.h" and "matrix.h", as it complains about syntax errors (like "missing ')' before identifier"). Has anyone encounter these errors before, and is there a workaround?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!