我正在构建一个包含已构建的POCO库的Android库。我的库正在构建时,我看到有关无效字符的错误。我不知道问题所在。
[armeabi-v7a] SharedLibrary : libndktest.so
C:/AndroidNative/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.
exe: error: ./obj/local/armeabi-v7a/objs/ndktest/WBXMLParser\stringconverter.o:1:9: invalid character
C:/AndroidNative/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.
exe: error: ./obj/local/armeabi-v7a/objs/ndktest/WBXMLParser\stringconverter.o:1:9: syntax error, unexpected $end
C:/AndroidNative/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.
exe: error: ./obj/local/armeabi-v7a/objs/ndktest/WBXMLParser\stringconverter.o: not an object or archive
collect2: ld returned 1 exit status
make.exe: *** [obj/local/armeabi-v7a/libndktest.so] Error 1
这就是我的Android.mk的样子。
LOCAL_PATH := $(call my-dir)
### include poco foundation as a prebuilt lib ###
include $(CLEAR_VARS)
LOCAL_MODULE := poco-foundation-prebuilt
LOCAL_SRC_FILES := ../pocolib/libPocoFoundation.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
LOCAL_CPP_FEATURES += rtti exceptions
include $(PREBUILT_STATIC_LIBRARY)
### include poco net as a prebuilt lib ###
include $(CLEAR_VARS)
LOCAL_MODULE := poco-net-prebuilt
LOCAL_SRC_FILES := ../pocolib/libPocoNet.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_STATIC_LIBRARIES := poco-foundation-prebuilt
include $(PREBUILT_STATIC_LIBRARY)
### include poco util as a prebuilt lib ###
include $(CLEAR_VARS)
LOCAL_MODULE := poco-util-prebuilt
LOCAL_SRC_FILES := ../pocolib/libPocoUtil.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_STATIC_LIBRARIES := poco-foundation-prebuilt
include $(PREBUILT_STATIC_LIBRARY)
### build ndk lib ###
include $(CLEAR_VARS)
TARGET_PLATFORM := android-8
LOCAL_MODULE := ndktest
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../pocolib/include
LOCAL_SRC_FILES := WBXMLParser\stringconverter.h \
WBXMLParser\WBXMLDocument.cpp \
WBXMLParser\WBXMLTag.cpp \
Classes.cpp \
FolderSyncAuth.cpp
LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_CPP_EXTENSION := .cpp .h
LOCAL_STATIC_LIBRARIES := poco-foundation-prebuilt \
poco-net-prebuilt \
poco-util-prebuilt
include $(BUILD_SHARED_LIBRARY)
答案 0 :(得分:0)
检查你的Android.mk 发现是否存在" LOCAL_CFLAGS + = -flto" 然后删除它 我解决了!
答案 1 :(得分:0)
正如Chris Stratton所注意到的, .h 文件不应列在LOCAL_SRC_FILES中。此外,你需要
LOCAL_LDLIBS += -latomic