繁体   English   中英

MPLAB X错误,usb_hal_pic24.h中类型为“ BYTE”的字段的“ packed”属性被忽略

[英]MPLAB X error, 'packed' attribute ignored for field of type 'BYTE in usb_hal_pic24.h

刚刚安装了MPLAB X,并导入了我正在从事的项目。 我收到此错误,并且因为它是一个应用程序库文件,所以我不太想修改它。 它引用的代码是:

// BDT Entry Layout
typedef union __BDT
{
union
{
    struct
    {
        BYTE CNT         __attribute__ ((packed));
        BD_STAT     STAT __attribute__ ((packed));
    };
    struct
    {
        WORD        count:10;   //test
        BYTE        :6;
        WORD        ADR; //Buffer Address
        };
    };
    DWORD           Val;
    WORD            v[2];
} BDT_ENTRY;

我想知道如何修改此设置或我的设置,以便进行编译。 我在MPLAB中没有收到此错误。

__attribute__ ((packed))可以安全地注释掉。

// BDT Entry Layout
typedef union __BDT
{
    union
    {
        struct
        {
            BYTE CNT    ; //__attribute__ ((packed)); suppress compiler warnings
            BD_STAT     STAT __attribute__ ((packed));
        };
        struct
        {
            WORD        count:10;   //test
            BYTE        :6;
            WORD        ADR; //Buffer Address
        };
    };
    DWORD           Val;
    WORD            v[2];
} BDT_ENTRY;

我必须修改USB硬件抽象层才能进行编译。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM