2012-04-30 24 views
1

我使用ndk r7c將一些Windows C++移植到ANSI以用於Android 4.0.3。「deque.h」中的android-ndk-r7c unqualified-id錯誤

原始代碼設置一個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 

之前編碼時,我已經看到了不合格-ID消息,但從來沒有發現什麼原因造成一個明確的答案。我曾嘗試在Tcan.h中的不同位置重新排列我的包含,沒有任何幫助。 Tcan.h:5是我的地方#include <queue>。有沒有一個錯誤,或者我在ndk中錯過了一些與隊列混淆的東西?或者有沒有人知道在deque中可能導致這個錯誤的原因?

感謝

編輯:使用NDK,經R 7b沒有什麼區別。我不認爲會這樣,但我想我會檢查。

回答

1

可能是一個問題,max是一個未聲明的宏:檢查第一篇文章here(它是關於最大3-arg,但問題似乎是相同的)。作爲修復,您也可以嘗試從max中刪除std::前綴,如第一篇文章here中所述。

+0

圖例,謝謝你,很好地做了這個訣竅。我忘了我已經在include中重新定義了max和min,刪除了這些定義,並將其改爲std :: max和std :: min。再次感謝。 – eskimo9