[英]Undefined reference error in NDK
I am trying to compile unrar for Android
but getting some undefined reference error
. 我正在尝试为
Android
编译unrar ,但遇到一些undefined reference error
。 I am stuck here for couple of days but can't find the exact problem. 我在这里呆了几天,但找不到确切的问题。 I tried to write
Android.mk
from existing makefile
. 我试图从现有的
makefile
编写Android.mk
。
jni/unrar/rar.cpp:104: error: undefined reference to 'CommandData::ParseCommandLine(bool, int, char**)'
jni/unrar/rar.cpp:107: error: undefined reference to 'CommandData::ReadConfig()'
jni/unrar/rar.cpp:108: error: undefined reference to 'CommandData::ParseEnvVar()'
jni/unrar/rar.cpp:110: error: undefined reference to 'CommandData::ParseCommandLine(bool, int, char**)'
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
UNRAR_PATH := $(LOCAL_PATH)/unrar
LOCAL_MODULE := unrar-jni
LOCAL_SRC_FILES := com_unrar_jni.cpp unrar/rar.cpp unrar/strlist.cpp unrar/strfn.cpp unrar/pathfn.cpp unrar/smallfn.cpp unrar/global.cpp unrar/file.cpp unrar/filefn.cpp unrar/filcreat.cpp \
unrar/archive.cpp unrar/arcread.cpp unrar/unicode.cpp unrar/system.cpp unrar/isnt.cpp unrar/crypt.cpp unrar/crc.cpp unrar/rawread.cpp unrar/encname.cpp \
unrar/resource.cpp unrar/match.cpp unrar/timefn.cpp unrar/rdwrfn.cpp unrar/consio.cpp unrar/options.cpp unrar/errhnd.cpp unrar/rarvm.cpp unrar/secpassword.cpp \
unrar/rijndael.cpp unrar/getbits.cpp unrar/sha1.cpp unrar/sha256.cpp unrar/blake2s.cpp unrar/hash.cpp unrar/extinfo.cpp unrar/extract.cpp unrar/volume.cpp \
unrar/list.cpp unrar/find.cpp unrar/unpack.cpp unrar/headers.cpp unrar/threadpool.cpp unrar/rs16.cpp unrar/cmddata.cpp unrar/ui.cpp \
unrar/filestr.cpp unrar/recvol.cpp unrar/rs.cpp unrar/scantree.cpp unrar/qopen.cpp
LOCAL_CFLAGS := -O2
LOCAL_CPPFLAGS := -fexceptions -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
CommandData
declares in cmddata.hpp
and implemented in cmddata.cpp
file. CommandData
声明中cmddata.hpp
和实施cmddata.cpp
文件。 rar.hpp
also includes cmddata.hpp
But why it's complaining that functions are undefined. rar.hpp
还包含cmddata.hpp
但是为什么会抱怨函数未定义。
The source code you found is not complete, and does not carry official claims to compile, especially under Android. 您找到的源代码不完整,并且没有官方要求进行编译,尤其是在Android下。 But the following steps can get you started:
但是以下步骤可以帮助您入门:
mkdir jni
#undef _ANDROID
#undef _ANDROID
ndk-build APP_CFLAGS="-Dgetpass\\(a\\)=a" APP_STL=stlport_static
c++_static may work, too ) ndk-build APP_CFLAGS="-Dgetpass\\(a\\)=a" APP_STL=stlport_static
c ++ _ static也可以 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.