gpt4 book ai didi

c++ - "deque.h"中的 android-ndk-r7c 不合格 id 错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:09:37 25 4
gpt4 key购买 nike

我正在使用 ndk r7c 将一些 Windows C++ 移植到 ANSI 以便在 Android 4.0.3 上使用。

原始代码设置了一个 UDP 客户端和一个它按设定的时间间隔检查的数据包队列,这样当程序在别处忙时队列就会填满,这样主程序就不会忙于轮询传入的数据包。代码比较长,这里就不贴了。

我不断收到消息:

In file included from C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/deque:65,
from C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/queue:61,
from jni/Tcan.h:5,
from jni/caneth_wrap.cpp:215:
C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_deque.h: In member function 'void std::_Deque_base<_Tp, _Alloc>::_M_initialize_map(size_t)':
C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_deque.h:498: error: expected unqualified-id before '(' token
In file included from C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/deque:68,
from C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/queue:61,
from jni/Tcan.h:5,
from jni/caneth_wrap.cpp:215:
C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/bits/deque.tcc: In member function 'void std::deque<_Tp, _Alloc>::_M_reallocate_map(size_t, bool)':
C:/Android/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/bits/deque.tcc:820: error: expected unqualified-id before '(' token

我以前在编码时看到过 unqualified-id 消息,但从未找到导致它的原因的明确答案。我曾尝试在 Tcan.h 的不同位置重新排列我的包含,但没有帮助。 Tcan.h:5 是我有 #include <queue> 的地方. ndk 中是否有错误或我遗漏的东西弄乱了队列?或者有人知道双端队列中此错误的可能原因吗?

谢谢

编辑: 使用 ndk-r7b 没有区别。我不认为它会,但我想我还是会检查一下。

最佳答案

可能是 max 是一个尚未声明的宏的问题:查看第一篇文章 here (这是关于 3-arg 最大值,但问题似乎是一样的)。作为修复,您还可以尝试从 max 中删除 std:: 前缀,如第一篇文章中所述 here .

关于c++ - "deque.h"中的 android-ndk-r7c 不合格 id 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10391860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com