我尝试使用NDK在Android Studio中编译c ++ lib并获得一些错误:
C:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\lib64\clang\3.8.275480\include\stddef.h:62:23: error: typedef redefinition with different types ('unsigned long' vs 'unsigned int') typedef __SIZE_TYPE__ size_t; ^../../../../src/main/cpp/include\Crypto/Core/Types.h:20:22: note: previous definition is here typedef unsigned int size_t;
当我定义
时typedef unsigned long size_t;
我明白了:
C:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\lib64\clang\3.8.275480\include\stddef.h:62:23: error: typedef redefinition with different types ('unsigned int' vs 'unsigned long') typedef __SIZE_TYPE__ size_t;^ ../../../../src/main/cpp/include\Crypto/Core/Types.h:20:23: note: previous definition is here typedef unsigned long size_t;
我该如何解决?
答案 0 :(得分:1)
您无法使用typedef
重新定义size_t
。如果你想要一个32位无符号整数,你可以写:
typedef unsigned long u32t
答案 1 :(得分:1)
size_t
已经是由多个C / C ++标准定义的数据类型。
尝试输入尚未在语言中定义的其他内容。
实施例: -
typedef unsigned long my_size_t;