Error while creating s-function build related to real_T and time_T

3 Ansichten (letzte 30 Tage)
Setty
Setty am 30 Jul. 2024
Beantwortet: Vidhi Agarwal am 31 Jul. 2024
I have C project and I'm trying to build a s-function for the C-project so that I can use the s-function for simulations in loop with some plant models. However I'm getting the following error
simstruc_types.h:134:5: error: unknown type name 'real_T' real_T** taskTime
rtw_solver.h:55:5: error: unknown type name 'time_T' time_T* stepSizePtr;
The same errors reflected in many other files. I just gave two examples just to explain the scenario. What should I do to get rid of the error?

Antworten (1)

Vidhi Agarwal
Vidhi Agarwal am 31 Jul. 2024
Hi Setty,
I assume you are encountering an error. This error usually indicates that the types “real_T” and “time_T” are not defined in project. These types are typically defined in the Simulink header files, specifically in “tmwtypes.h”. To resolve these errors, ensure that the necessary Simulink header files are included in S-function code and that include paths are correctly set up.
Below are the steps that can help in resolving the issue:
  1. Make sure S-function source file includes the necessary Simulink headers. Typically, you would include “simstruc.h, which in turn includes “tmwtypes.h” where “real_T” and “time_T” are defined.
  2. Ensure that the include paths for the Simulink headers are correctly set up in project. This can be done by adding the include paths to your compiler's include directories. The paths typically include the directories where MATLAB and Simulink are installed.
  3. Ensure that compiler is correctly configured to use the Simulink libraries and header files. If you are using a makefile or a project file, add the necessary include paths and library paths.
  4. After ensuring that the necessary headers are included and the include paths are correctly set up, rebuild S-function
Hope that helps!

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by