使用Android NDK编译Boost时assert.h冲突
assert.h conflict when compiling Boost with Android NDK
当尝试使用Android NDK使用Boost c++库编译程序时,我会收到以下类型的错误:
In file included from /home/afeder/android/0ad/jni/lib/boost/boost/assert.hpp:50,
from /home/afeder/android/0ad/jni/lib/boost/boost/random/linear_congruential.hpp:21,
from /home/afeder/android/0ad/jni/src/source/scriptinterface/ScriptInterface.h:34,
from /home/afeder/android/0ad/jni/src/source/ps/World.h:28,
from /home/afeder/android/0ad/jni/src/source/main.cpp:58:
/home/afeder/android/android-ndk-r7/platforms/android-5/arch-arm/usr/include/assert.h: At global scope:
/home/afeder/android/android-ndk-r7/platforms/android-5/arch-arm/usr/include/assert.h:63: warning: redundant redeclaration of 'void __assert(const char*, int, const char*)' in same scope
/home/afeder/android/android-ndk-r7/platforms/android-5/arch-arm/usr/include/assert.h:63: warning: previous declaration of 'void __assert(const char*, int, const char*)'
/home/afeder/android/android-ndk-r7/platforms/android-5/arch-arm/usr/include/assert.h:64: warning: redundant redeclaration of 'void __assert2(const char*, int, const char*, const char*)' in same scope
/home/afeder/android/android-ndk-r7/platforms/android-5/arch-arm/usr/include/assert.h:64: warning: previous declaration of 'void __assert2(const char*, int, const char*, const char*)'
很明显,Boost提供的一组"断言"函数和NDK本身提供的函数之间存在某种冲突,但我该如何解决?
谢谢。
头文件有#define宏,它封装了整个头文件的内容。在你的源代码中,你可以更喜欢取消定义你不需要的标题。
例如,如果Boost头文件具有#define Boost_SSERT_HPP,而NDK具有ANDROID_ASSERT_H,则在源中,可以使用#undef Boost_ASSERT_HPP来取消Boost相关头的定义。
相关文章:
- 写入位置0x0000000C时发生访问冲突
- GL_SHADERSTORAGE_BUFFER位置是否与其他着色器位置冲突
- 使用cmake从源代码构建MySQL连接器/C++失败(与以前的声明冲突)
- 引发异常:读取访问冲突**dynamicArray**为0x1118235.发生
- C++LinkedList问题.数据类型之间存在冲突?没有匹配的构造函数
- 链表中写入访问冲突的未知原因
- C++中的openCV Mat访问冲突
- 如何使 std::sort 在 std::swap 和我的命名空间的模板化交换之间没有名称冲突?
- C++尝试深度复制唯一指针时出现内存访问冲突
- 错误:使用通用引用的声明冲突
- 如何解决GTest和LibTorch联动冲突
- 两个运营商的一些奇怪的冲突<<
- 如何在多个线程中创建 QSql数据库连接时防止名称冲突
- C++ 中动态二维数组的访问冲突
- 从嵌套循环中的 std::list 中删除将返回访问冲突
- C++17 十六进制浮点文字单精度后缀冲突?
- 结构字段名称与 GDB 中的 STL 数组冲突
- 写入访问冲突异常
- C++ |匿名命名空间与命名空间 std 冲突
- 使用Android NDK编译Boost时assert.h冲突