2015-10-21 100 views
0

我使用C++使用已經提到NDK Boost庫與NDK創建可執行文件時存在問題,這是問題未定義參考NDK升壓安卓

C:\Users\GENERAL\Downloads\Compressed\tcpproxy\proxy\jni>ndk-build 
[armeabi] Compile++ thumb: proxy <= tcpproxy_server.cpp 
[armeabi] Executable  : proxy 
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/sys 
tem/error_code.hpp:322: error: undefined reference to 'boost::system::system_cat 
egory()' 
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/thr 
ead/exceptions.hpp:51: error: undefined reference to 'boost::system::system_cate 
gory()' 
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/asi 
o/error.hpp:225: error: undefined reference to 'boost::system::system_category() 
' 
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/asi 
o/error.hpp:225: error: undefined reference to 'boost::system::system_category() 
' 
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/sys 
tem/error_code.hpp:221: error: undefined reference to 'boost::system::generic_ca 
tegory()' 
C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//jni/boost_1_56_0/boost/sys 
tem/error_code.hpp:222: error: undefined reference to 'boost::system::generic_ca 
tegory()' 
collect2.exe: error: ld returned 1 exit status 
make.exe: *** [C:/Users/GENERAL/Downloads/Compressed/tcpproxy/proxy//obj/local/a 
rmeabi/proxy] Error 1 

Android.mk:

LOCAL_PATH := $(call my-dir) 
include $(CLEAR_VARS) 
LOCAL_C_INCLUDES  += $(LOCAL_PATH)/boost_1_56_0 #patch of include BOOST 
LOCAL_MODULE := proxy 
LOCAL_SRC_FILES := tcpproxy_server.cpp 
include $(BUILD_EXECUTABLE) 

Application.mk

APP_CFLAGS += -fexceptions 
APP_STL := gnustl_static 
NDK_TOOLCHAIN_VERSION := 4.8 
APP_CPPFLAGS := -std=c++11 

即編譯時,我得到的錯誤。已經調查但找不到解決方案,所以請感謝您的答案,以便能夠修復它,並且因爲生成該錯誤感謝

回答

0

您可能需要添加boost_system庫。您可以添加-lboost_system到鏈接器標誌,以找到相關的庫符號Android.mk(假設升壓內置靜態):

LOCAL_STATIC_LIBRARIES = -lboost_system ... 
include $(BUILD_STATIC_LIBRARY)