ISO C++ 禁止声明没有类型的 'int32'
ISO C++ forbids declaration of 'int32' with no type
正在尝试构建 AOSP 版本并遇到此错误
error: ISO C++ forbids declaration of 'int32' with no type
error: typedef 'int32' is initialized (use decltype instead)
error: 'loc_event_cb_f_type' was not declared in this scope
这是抛出错误的声明
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 没有定义或包含在任何地方
如@luuserdroog 所写,
Should it be int32_t?
int32_t 和其他 intX_t 类型定义在 /usr/include/stdint.h 中定义,因此可以通过将所有 int32 替换为 int32_t 或@JonathanLeffler 提议来解决, 定义了int32类型,更方便干净。
typedef uint32_t uint32;
但要解决其他文件的这个问题,
将此声明添加到 /usr/include/stdint.h 将起作用
#ifndef __uint8_defined
typedef uint8_t uint8;
# define __uint8_defined
#endif
#ifndef __int8_defined
typedef int8_t int8;
# define __int8_defined
#endif
#ifndef __uint16_defined
typedef uint16_t uint16;
# define __uint16_defined
#endif
#ifndef __int16_defined
typedef int16_t int16;
# define __int16_defined
#endif
#ifndef __uint32_defined
typedef uint32_t uint32;
# define __uint32_defined
#endif
#ifndef __int32_defined
typedef int32_t int32;
# define __int32_defined
#endif
#ifndef __uint64_defined
typedef uint64_t uint64;
# define __uint64_defined
#endif
#ifndef __int64_defined
typedef int64_t int64;
# define __int64_defined
#endif
正在尝试构建 AOSP 版本并遇到此错误
error: ISO C++ forbids declaration of 'int32' with no type
error: typedef 'int32' is initialized (use decltype instead)
error: 'loc_event_cb_f_type' was not declared in this scope
这是抛出错误的声明
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 没有定义或包含在任何地方
如@luuserdroog 所写,
Should it be int32_t?
int32_t 和其他 intX_t 类型定义在 /usr/include/stdint.h 中定义,因此可以通过将所有 int32 替换为 int32_t 或@JonathanLeffler 提议来解决, 定义了int32类型,更方便干净。
typedef uint32_t uint32;
但要解决其他文件的这个问题,
将此声明添加到 /usr/include/stdint.h 将起作用
#ifndef __uint8_defined
typedef uint8_t uint8;
# define __uint8_defined
#endif
#ifndef __int8_defined
typedef int8_t int8;
# define __int8_defined
#endif
#ifndef __uint16_defined
typedef uint16_t uint16;
# define __uint16_defined
#endif
#ifndef __int16_defined
typedef int16_t int16;
# define __int16_defined
#endif
#ifndef __uint32_defined
typedef uint32_t uint32;
# define __uint32_defined
#endif
#ifndef __int32_defined
typedef int32_t int32;
# define __int32_defined
#endif
#ifndef __uint64_defined
typedef uint64_t uint64;
# define __uint64_defined
#endif
#ifndef __int64_defined
typedef int64_t int64;
# define __int64_defined
#endif