简体   繁体   English

typedef 结构错误:应为“;”

[英]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.该代码有望工作,因为我是从第 3 方作为教程的一部分获得的。

It should be:它应该是:

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

The attribute has to come after the structure declaration.该属性必须在结构声明之后。

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

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