gpt4 book ai didi

c - c 中的 ')' token 错误之前预期为 '*'

转载 作者:行者123 更新时间:2023-11-30 15:34:32 29 4
gpt4 key购买 nike

以下是我的.h文件

  1 typedef int32_t status_t;
2 typedef u_int16_t pic_id_t;
3 typedef const char* (*pic_flavor_t) (pic_t *);
4 typedef status_t (*pic_periodic_t) (pic_t *);
5 typedef status_t (*pic_get_port_info_t) (pic_t *pic, u_int16_t link,void *info,boolean *need_update);
6
7 struct pic_
8 {
9 u_int16_t nic_slot;
10 u_int16_t pic_slot;
11 u_int32_t pic_flags;
12 pic_id_t pic_id;
13 u_int16_t pic_asic_type;
14 u_int16_t pic_firstport;
15 pic_periodic_t pic_periodic;
16 pic_flavor_t pic_flavor;
17 pic_get_port_info_t pic_get_port_info;
18 void *pic_context;
19 }pic_t;
20

这些是我遇到的错误。

../../../../../src/pfe/common/drivers/rpio/rpio_tunnel_pvt1.h:3: error: expected ')'   before '*' token
../../../../../src/pfe/common/drivers/rpio/rpio_tunnel_pvt1.h:4: error: expected ')' before '*' token
../../../../../src/pfe/common/drivers/rpio/rpio_tunnel_pvt1.h:5: error: expected ')' before '*' token
../../../../../src/pfe/common/drivers/rpio/rpio_tunnel_pvt1.h:15: error: expected specifier-qualifier-list before 'pic_periodic_t'

我正在尝试为我的 .c 文件创建一个新的 .h 文件。在这里,我包含了 .c 文件中所需的一些结构的定义我无法解决这些错误。

最佳答案

以下似乎有效

typedef struct pic_ pic_t;
typedef int32_t status_t;
typedef u_int16_t pic_id_t;
typedef const char* (*pic_flavor_t) (pic_t *);
typedef status_t (*pic_periodic_t) (pic_t *);
typedef status_t (*pic_get_port_info_t) (pic_t *pic, u_int16_t link,void *info, boolean *need_update);

struct pic_
{
u_int16_t nic_slot;
u_int16_t pic_slot;
u_int32_t pic_flags;
pic_id_t pic_id;
u_int16_t pic_asic_type;
u_int16_t pic_firstport;
pic_periodic_t pic_periodic;
pic_flavor_t pic_flavor;
pic_get_port_info_t pic_get_port_info;
void *pic_context;
};

关于c - c 中的 ')' token 错误之前预期为 '*',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23239982/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com