Conflict bewteen rtwtypes and tmwtypes

42 次查看(过去 30 天)
Felipe Herrera
Felipe Herrera 2024-12-3
编辑: Abhaya 2024-12-24,9:56
I'm testing the embedded coder app in Simulink. I have generated C code for a simple adder which takes two numbers and add them. I succesfully generated the C code for this simulink model, and now I'm trying to make it work in the S-function builder. When I build the code, the following errors appears:
line 1: rtwtypes.h:77:16: error: conflicting types for 'byte_T' typedef char_T byte_T;
line 2: tmwtypes.h:580:16: note: previous declaration of 'byte_T' was here typedef BYTE_T byte_T;
I understand that "byte_T" is being defined in two different header files. However, I don't know how to avoid this. The answer given in this question suggest to include the following lines of code:
#if defined(MATLAB_MEX_FILE)
#include "tmwtypes.h"
#include "simstruc_types.h"
#else
#include "rtwtypes.h"
#endif
However, this lines of code are already included in the wrapper generated by the S-function builder. How could I avoid this clash between rtwtypes.h and tmwtypes.h?
  3 个评论
Abhaya
Abhaya 2024-12-23,10:50
Hi Felipe, Could you share the C file and wrapper generated by S- function builder?
Abhaya
Abhaya 2024-12-24,6:20
编辑:Abhaya 2024-12-24,9:56
Hi Felipe,
I tried to reproduce the model, and here are the steps I followed:
  1. I added two 'Constant' blocks as inputs and a 'Display' block as output.
  2. I included an 'S-function Builder' block in the model.
  3. I implemented the addition functionality in the 'S-function Builder' in the 'Editor' tab. Here’s the code I used:
void delS_Outputs_wrapper(const real_T *u0,
const real_T *u1,
real_T *y0)
{
/* Output_BEGIN */
/* This sample sets the output equal to the input */
y0[0]=u0[0]+u1[0];
/* Output_END */
}
The model works fine on my end.
I suspect that the error you're encountering may be related to the inclusion of the rtwtypes.h file. In the 'Editor' tab of the S-function Builder, if you have included 'rtwtypes.h' file, this could be causing the issue.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by