我正在尝试为Android
编译unrar,但要获得一些undefined reference error
。我被困在这里几天,但无法找到确切的问题。我尝试从现有的Android.mk
撰写makefile
。
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
在cmddata.hpp
中声明,并在cmddata.cpp
文件中实施。 rar.hpp
还包括cmddata.hpp
但是为什么它抱怨函数未定义。
答案 0 :(得分:1)
The source code you found is not complete, and does not carry official claims to compile, especially under Android. But the following steps can get you started:
mkdir jni
#undef _ANDROID
ndk-build APP_CFLAGS="-Dgetpass\(a\)=a" APP_STL=stlport_static
c++_static may work, too)