【发布时间】:2020-12-28 10:47:16
【问题描述】:
尝试构建 AOSP 版本并收到此错误
错误:ISO C++ 禁止声明没有类型的“int32”
错误:typedef 'int32' 已初始化(改用 decltype)
错误:“loc_event_cb_f_type”未在此范围内声明
这是引发错误的声明
typedef int32 (loc_event_cb_f_type)(
rpc_loc_client_handle_type loc_handle, /* handle of the client */
rpc_loc_event_mask_type loc_event, /* event mask */
const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
);
这是完整的文件:/libloc_api-rpc/rpc_inc/loc_api_rpc_glue.h
#ifndef LOC_API_RPC_GLUE_H
#define LOC_API_RPC_GLUE_H
/* Include RPC headers */
#include "rpc_inc/loc_api_common.h"
#include "rpc_inc/loc_api.h"
#include "rpc_inc/loc_api_cb.h"
#include "rpc_inc/loc_api_fixup.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* Boolean */
/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
typedef unsigned char boolean;
#define TRUE 1
#define FALSE 0
extern int loc_api_glue_init(void);
extern int loc_api_null(void);
typedef int32 (loc_event_cb_f_type)(
rpc_loc_client_handle_type loc_handle, /* handle of the client */
rpc_loc_event_mask_type loc_event, /* event mask */
const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
);
extern rpc_loc_client_handle_type loc_open(
rpc_loc_event_mask_type event_reg_mask,
loc_event_cb_f_type* event_callback
);
extern int32 loc_close
(
rpc_loc_client_handle_type handle
);
extern int32 loc_start_fix
(
rpc_loc_client_handle_type handle
);
extern int32 loc_stop_fix
(
rpc_loc_client_handle_type handle
);
extern int32 loc_ioctl
(
rpc_loc_client_handle_type handle,
rpc_loc_ioctl_e_type ioctl_type,
rpc_loc_ioctl_data_u_type* ioctl_data
);
#ifdef __cplusplus
}
#endif
#endif /* LOC_API_RPC_GLUE_H */
你有什么想法吗?
【问题讨论】:
-
应该是
int32_t? -
当我尝试从显示的代码中创建 MCVE(Minimal, Complete, Verifiable Example — 或 MRE 或 SO 现在使用的任何名称)或 SSCCE(Short, Self-Contained, Correct Example)时,我无法重现该错误。请创建一个确实重现问题的 MCVE — 但您很可能会在创建 MCVE 时找到解决方案,然后您可以删除此问题。
-
FWIW:我使用的非复制尝试的 MCVE:
#include <stdint.h>和typedef int32_t int32; struct rpc_loc_client_handle_type { int h; }; struct rpc_loc_event_mask_type { int mask 4 ; }; struct rpc_loc_event_payload_u_type; typedef int32 (loc_event_cb_f_type)( rpc_loc_client_handle_type loc_handle, rpc_loc_event_mask_type loc_event, const rpc_loc_event_payload_u_type *loc_event_payload ); extern loc_event_cb_f_type loc_type;— cmets 中的格式不好。 -
@luserdroog 你知道int32是否只在windows上定义?
-
@JoseMiguelArroyave 对不起,我不知道。如果包含
stdint.h,我知道int32_t是C 中的标准类型。我在 windows 上使用 cygwin 环境,所以我可以假装它是 unix。
标签: c++ c linux build android-source