Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
i have created an android application,here most of my code is in c so i have created it using jni. i have to create socket.so file, in which i have to use the libtest.so.

while using the libtest.so in socket.so i get the error:undefined reference to function(). my function() is present inside the libtest.so. so to avid this by suggestion i have created my Android.mk as below:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libtest
LOCAL_SRC_FILES := libtest.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := socket
LOCAL_SHARED_LIBRARIES += libtest
LOCAL_SRC_FILES := source/interface.c source/file.c
LOCAL_LDFLAGS += libtest.a  
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../libtest/jni/include
include $(BUILD_SHARED_LIBRARY)

but it requires both the libtest.so & libtest.a file to be present. where as if i am using only the libtest.a it works perfectly fine.

since my requirement is to create libtest.so and include it in socket.so can any one please tell me how to avoid dependency of .a file to create .so file.

if i will comment LOCAL_LDFLAGS += libtest.a then i am getting the error:undefined reference to function()

any one plz help me to get out of this problem.......
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900