简体   繁体   中英

typedef struct error: expected a ';'

#pragma once
typedef struct __attribute__((packed)) {
} msg_gps_time_t;

I have this code and it gives the following error: expected a ';' The code is expected to work since i got it from a 3rd party as part of a tutorial.

It should be:

typedef struct  {
} __attribute__((packed)) msg_gps_time_t;

The attribute has to come after the structure declaration.

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