![](/img/trans.png)
[英]Linker error in USB HID Code for Microchip PIC (MPLAB/C18)
[英]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.