Miracle Yahka
Miracle Yahka

Reputation: 1

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

Upvotes: 0

Views: 152

Answers (1)

ouah
ouah

Reputation: 145829

__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.

Upvotes: 5

Related Questions