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

조회 수: 4 (최근 30일)
Setty
Setty 2024년 7월 30일
답변: Vidhi Agarwal 2024년 7월 31일
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?

답변 (1개)

Vidhi Agarwal
Vidhi Agarwal 2024년 7월 31일
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!

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by