STM32CubeIDE - __packed 之前的预期说明符限定符列表

问题描述

我正在将用 IAR 编写的代码移植到 STCube。

在 IAR 中工作的相同代码在 STCube 上有以下错误

错误:__packed 之前的预期说明符限定符列表

typedef union
{
    __packed struct
   {
      uint8_t Effect;
      uint16_t Index;
      uint8_t Xini;
      uint8_t YIni;
      uint8_t XFim;
      uint8_t YFim;
      uint8_t NextEffect;
    };
    uint8_t data[8];
 } FILE_UNION;
 extern FILE_UNION FILE_TIME;

有谁知道编译器中缺少哪个参数?

解决方法

解决方案。

 __attribute__ ((packed)) struct;