project directory structure
declared in the header file NZEncryption.c
#include <string.h>
#include <jni.h>
#include "des.h"
Then Android.mk in writing as follows:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
LOCAL_MODULE := NewZone01
LOCAL_SRC_FILES := NZEncryption.c\
des.cpp
include $(BUILD_SHARED_LIBRARY)
but using Cygwin build . so file , the prompt : undefined reference to "des_encrypt"
When des_encrypt declared in des.h , implemented in des.cpp
do not know how , how can correctly generate the
------ Solution ------------------------------------ --------
C defined function calls inside the CPP , you need to add anything inside
extern "C" {
...
}
------ For reference only --------------------------------- ------
If android.mk to add this one : LOCAL_ALLOW_UNDEFINED_SYMBOLS: = true
is able to compile, but running error.
should be a function of not being properly compiled in.
------ For reference only -------------------------------------- -
your project inside another cpp, c ??
------ For reference only ---------------------- -----------------
Yes , NDK to the sample code in there ,
project where you can have c, cpp, there
------ For reference only ----- ----------------------------------
positive solution, thank you very much !
没有评论:
发表评论