简体   繁体   中英

Error in my c program

I am trying to compile program for pic18f4550 using C18 Compiler. I have a syntax error at this line:

typedef struct __attribute__ ((packed)) _USB_DEVICE_DESCRIPTOR

Any suggestions are appreciated

__attribute__ ((packed)) is a GNU extension and is not C and this syntax is not available in C18.

Note that regarding structure padding, C18 compiler documentation says:

ANSI C Standard : “The padding and alignment of members of structures (6.5.2.1).”

Implementation : Members of structures and unions are aligned on byte boundaries.

so there is no need to pack the structure members through compiler extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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