2012-07-12 55 views
0

我在Necessitas版本的Qt Creator中開始了一個Qt移動應用程序項目,專門針對API 15。從那裏,我有一些我在Eclipse中編寫的C++源代碼,我添加到了該項目中。當然,還有很多未定義的引用錯誤(由於Qt Necessitas默認情況下沒有在操作系統的include/lib路徑中查找),所以我做了一些Google搜索並找到了一個解決方案。QT Necessitas - 鏈接gnu-libstdC++時的神祕ctype_base.h錯誤

現在,之後似乎工作,我似乎得到一些奇怪的錯誤,處理與Android/ARM的GNU的stlport。

谷歌搜索,以及發現this。如果你閱讀最後一篇文章,OP最終很難被發現,並且很難找出問題所在。我的錯誤似乎有點不同,但仍然和他/她的相同。

基本上,我可以真正使用一些指導如何解決這個問題。如果有人有任何想法或已經遇到同樣的問題,我真的很感激建議!

底部是ctype_base.h的pastebin。

謝謝!

在該問題

所以,因爲我連接的GNU的libstdC++(在.so版本,據我所知),我在ctype_base.h收到以下錯誤:

/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:44: error: '_U' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:45: error: '_L' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:46: error: '_U' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:46: error: '_L' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:47: error: '_N' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:48: error: '_X' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:48: error: '_N' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:49: error: '_S' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:50: error: '_P' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:50: error: '_U' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:50: error: '_L' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:50: error: '_N' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:50: error: '_B' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:51: error: '_P' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:51: error: '_U' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:51: error: '_L' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:51: error: '_N' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:52: error: '_C' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:53: error: '_P' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:54: error: '_U' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:54: error: '_L' was not declared in this scope 
/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h:54: error: '_N' was not declared in this scope 

由於Qt的Necessitas NDK似乎有兩個版本,我決定用我收到的最新版本進行推出。當然,Necessitas還不完全穩定(仍然在Alpha 3,IIRC中),所以我不能期望太多,但是在Eclipse中有一些非常不必要的錯誤診斷體驗之後,我真的很討厭必須回到那裏再次。不要誤會我的意思,如果你在做Java開發,那絕對是一條可行的路。只是......不是C++;)

這是我的.pro文件以及:

# Add files and directories to ship with the application 
# by adapting the examples below. 
# file1.source = myfile 
# dir1.source = mydir 
DEPLOYMENTFOLDERS = # file1 dir1 

symbian:TARGET.UID3 = 0xED47BA19 

# Smart Installer package's UID 
# This UID is from the protected range 
# and therefore the package will fail to install if self-signed 
# By default qmake uses the unprotected range value if unprotected UID is defined for the application 
# and 0x2002CCCF value if protected UID is given to the application 
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF 

# Allow network access on Symbian 
symbian:TARGET.CAPABILITY += NetworkServices 

# If your application uses the Qt Mobility libraries, uncomment 
# the following lines and add the respective components to the 
# MOBILITY variable. 
# CONFIG += mobility 
# MOBILITY += 

SOURCES += main.cpp mainwindow.cpp \ 
    GLTriangleDemo.cpp \ 
    Debug.cpp \ 
    Shader.cpp 
HEADERS += mainwindow.h \ 
    GLincludes.hpp \ 
    GLDemo.hpp \ 
    Entry.hpp \ 
    Debug.hpp \ 
    Triangle.hpp \ 
    Shape.hpp \ 
    Shader.hpp \ 
    GLTriangleDemo.hpp 
FORMS += mainwindow.ui 

#includes 

INCLUDEPATH += /usr/include 

#external deps 
external_libs.files += /usr/lib 

x86 { 
     external_libs.path = /libs/x86 
} else: armeabi-v7a { 
     external_libs.path = /libs/armeabi-v7a 
} else { 
     external_libs.path = /libs/armeabi 
} 

INSTALLS += external_libs 

LIBS += -llog -lGLESv2 -lgnustl_shared 

# Please do not modify the following two lines. Required for deployment. 
include(deployment.pri) 
qtcAddDeployment() 

OTHER_FILES += \ 
    android/res/values-ja/strings.xml \ 
    android/res/values-it/strings.xml \ 
    android/res/values-pt-rBR/strings.xml \ 
    android/res/values-el/strings.xml \ 
    android/res/values-nl/strings.xml \ 
    android/res/values-ro/strings.xml \ 
    android/res/values-id/strings.xml \ 
    android/res/values-fr/strings.xml \ 
    android/res/values-rs/strings.xml \ 
    android/res/values-de/strings.xml \ 
    android/res/drawable-hdpi/icon.png \ 
    android/res/values-pl/strings.xml \ 
    android/res/values-ru/strings.xml \ 
    android/res/values-es/strings.xml \ 
    android/res/values-ms/strings.xml \ 
    android/res/values/strings.xml \ 
    android/res/values/libs.xml \ 
    android/res/drawable/icon.png \ 
    android/res/drawable/logo.png \ 
    android/res/values-zh-rTW/strings.xml \ 
    android/res/layout/splash.xml \ 
    android/res/values-fa/strings.xml \ 
    android/res/drawable-mdpi/icon.png \ 
    android/res/drawable-ldpi/icon.png \ 
    android/res/values-nb/strings.xml \ 
    android/res/values-zh-rCN/strings.xml \ 
    android/res/values-et/strings.xml \ 
    android/version.xml \ 
    android/AndroidManifest.xml \ 
    android/src/org/kde/necessitas/origo/QtApplication.java \ 
    android/src/org/kde/necessitas/origo/QtActivity.java \ 
    android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl \ 
    android/src/org/kde/necessitas/ministro/IMinistro.aidl 

而且,這裏的ctype_base.h

回答

1

pastebin我經歷了同樣的問題。在我看來,問題似乎是由環境變量引起的,即「CPLUS_INCLUDE_PATH」和「C_INCLUDE_PATH」。這些變量包含我的系統的路徑C++包括哪些,我猜是干擾了armabi平臺包括。

解決方案:我只是取消設置這兩個env。變量。

Redgis

PS:我edidted我以前的答案,但依然被標記爲 「已刪除」,所以我重新發布。我不這樣做,但我沒有看到另一種方式來發布我的貢獻。

+0

謝謝,夥計。當我回到Android開發時,我會參考這一點。 – zeboidlund 2012-08-01 03:01:37