Search code examples
c++android-ndkqueuegnudeque

android-ndk-r7c unqualified-id error in "deque.h"


I'm porting some Windows C++ to ANSI to be used on Android 4.0.3, using ndk r7c.

The original code sets up a UDP client and a packet queue that it checks at set intervals, so that the queue fills up while the program is busy elsewhere, so the main program isn't tied up polling the incoming packets. The code is fairly long, so I won't post it here yet.

I keep getting the message:

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

I've seen the unqualified-id message when coding before, but never found a definitive answer for what causes it. I have tried rearranging my includes in different places in Tcan.h, no help. Tcan.h:5 is where I have #include <queue>. Is there a bug or something I've missed in ndk that messes with queue? Or does anyone know of possible causes of this error in deque?

Thanks

EDIT: Using ndk-r7b makes no difference. I didn't think it would, but thought I'd check anyway.


Solution

  • Might be a problem with max being a macro which has not been declared: check the first post here (it's about a 3-arg max, but the problem seems to be the same). As a fix, you can also try removing the std:: prefix from max, as in the first post here.