I now have an android project, there is a des.h header files and des.cpp, NZEncryption.c two documents, some of the functions declared in the header file des.h achieve in des.cpp in. Then NZEncryption.c used,
Project directory structure
In NZEncryption.c declared in the header file
# include
# Include
# Include "des.h"
Then write Android.mk 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 when so files generated with Cygwin prompt:. Undefined reference to "des_encrypt"
When des_encrypt has been declared in des.h, the realization of
in des.cppI do not know how it happened, how can the right to generate
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
If you add in android.mk in this sentence: LOCAL_ALLOW_UNDEFINED_SYMBOLS: = true
Is able to compile, but running error.
Should be a function of not being properly compiled in.
Reply:
Your works have cpp c there's??
Reply:
Yes, the sample code given in NDK also,
Project where you can have
c, cpp there's

Reply:
C-defined function calls inside the CPP, the need to add to what
extern "C" {
...
}
Reply:
Positive solution, thank you very much!
No comments:
Post a Comment