使用 g++ 构建 adb 时无法识别_Nonnull
Can't recognize _Nonnull when building adb with g++
我正在尝试从 AOSP android 7.1.2 源代码构建 adb,并使用 g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5( 5.4.0 20160609编译它,方法是根据 Android.mk 慢慢添加包含和库,并随时修复编译器的投诉。到目前为止,我得到了下面的命令,但我不确定如何解决下面的错误:
adb-1.0.36/system/core$ g++ -o ./adb/adb_client{,.cpp} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wvla -DADB_REVISION='1.0.36' -std=c++14 -I./base/include/ -I./include -lrt -ldl -lpthread -fvisibility=hidden
In file included from ./adb/adb_client.cpp:20:0:
./adb/adb_client.h:28:67: error: expected ‘,’ or ‘...’ before ‘error’
int adb_connect(const std::string& service, std::string* _Nonnull error);
^
./adb/adb_client.h:29:68: error: expected ‘,’ or ‘...’ before ‘error’
int _adb_connect(const std::string& service, std::string* _Nonnull error);
^
./adb/adb_client.h:37:66: error: expected ‘,’ or ‘...’ before ‘result’
bool adb_query(const std::string& service, std::string* _Nonnull result,
^
./adb/adb_client.h:41:66: error: expected ‘,’ or ‘...’ before ‘serial’
void adb_set_transport(TransportType type, const char* _Nullable serial);
^
./adb/adb_client.h:44:49: error: expected ‘,’ or ‘...’ before ‘type’
void adb_get_transport(TransportType* _Nullable type, const char* _Nullable* _Nullable serial);
^
./adb/adb_client.h:50:45: error: expected ‘,’ or ‘...’ before ‘hostname’
void adb_set_tcp_name(const char* _Nullable hostname);
^
./adb/adb_client.h:55:61: error: expected ‘,’ or ‘...’ before ‘*’ token
int adb_send_emulator_command(int argc, const char* _Nonnull* _Nonnull argv,
^
./adb/adb_client.h:60:47: error: expected ‘,’ or ‘...’ before ‘error’
bool adb_status(int fd, std::string* _Nonnull error);
^
./adb/adb_client.h:63:54: error: expected ‘,’ or ‘...’ before ‘command’
std::string format_host_command(const char* _Nonnull command, TransportType type,
^
./adb/adb_client.h:67:47: error: expected ‘,’ or ‘...’ before ‘feature_set’
bool adb_get_feature_set(FeatureSet* _Nonnull feature_set, std::string* _Nonnull error);
^
似乎_Nonnull和_Nullable是在 ./adb/sysdeps.h 中定义的
58 // Clang-only nullability specifiers
57 #define _Nonnull
59 #define _Nullable
似乎 AOSP 7.1.2 是 gcc 4.8 附带的。另外,我注意到 -Wexit-time-destructors 似乎不是我正在使用的 g++ 的一部分,也不是 -compatibility_version
ltecoe@ltecoe:~/imx6solox-yocto-bsp/sources/meta-harris-tools/recipes-connectivity/adb/adb-1.0.36/system/core$ g++ -o ./adb/adb_client{,.cpp} -compatibility_version -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wvla -DADB_REVISION='1.0.36' -std=c++14 -Wexit-time-destructors -I./base/include/ -I./include -lrt -ldl -lpthread
g++: error: unrecognized command line option ‘-compatibility_version’
g++: error: unrecognized command line option ‘-Wexit-time-destructors’
_Nonnull
和_Nullable
是Clang的私钥。由于条件#ifdef _WIN32
,未执行 2 行声明。
因此,为了在 Linux 上使用 g++
编译它,请将这两个声明放到它们在全球范围内生效的其他地方。
相关文章:
- 提升 ASIO 无法识别计时器对象
- 从udp接收帧对于人脸识别来说太慢
- 模板类无法识别友元运算符
- std::visit无法识别类型
- 无法识别模板功能
- 我有两个类需要在同一 cpp 文件中相互引用,但第一个类无法识别第二个类类型的对象
- 如何在LLVM中dyn_cast以识别StoreInst?
- 从不同的附加依赖项中识别等同命名的函数
- C++出现控制台错误.我无法识别源代码的问题
- VSCode IntelliSense无法识别SDL框架的SDL_image扩展库
- Qt:"Q3DScatter"即使包含在内也无法识别
- 使用指针的类识别
- 如何静态识别动态堆分配?
- 为什么C++无法识别我的对象实例化?
- C++ 无法识别创建进程'telnet'
- 识别 2D 矢量C++中的位置
- 如何识别项目是 QT 中的文件还是文件夹
- ESP32 无法识别任何设备已连接到其接入点
- 无法识别 Mac c++ 文件系统库
- 识别数组中的重复元素?