我在 Qt Creator 的 Necessitas 版本中启动了一个 Qt 移动应用程序项目,专门针对 API 15。从那里,我有一些我在 Eclipse 中编写的 C++ 源代码,我将它们添加到项目中。当然,有很多未定义的参考错误(由于 Qt Necessitas 的性质,默认情况下不查看操作系统的 include/lib 路径),所以我做了一些谷歌搜索并找到了修复。
现在,在这似乎工作之后,我似乎遇到了一些奇怪的错误,这些错误涉及 GNU 的 Android/ARM stlport。
谷歌搜索了一下,发现了这个。如果您阅读了最后一篇文章,那么 OP 最终会非常难过,并且很难找出问题所在。我的错误似乎有点不同,但仍然相对于他/她的同盟。
基本上,我真的可以使用一些指导来解决这个问题。如果有人对此有任何想法或遇到同样的问题,我将非常感谢您的建议!
底部是 ctype_base.h 的 pastebin。
谢谢!
解决问题
所以,因为我正在链接 gnu-libstdc++(.so
版本,AFAIK),我收到了以下错误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 的pastebin