Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8285769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:32:57+00:00 2026-06-08T11:32:57+00:00

i have created an android application,here most of my code is in c so

  • 0

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…….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:32:58+00:00Added an answer on June 8, 2026 at 11:32 am

    Seems a bit unclean.

    The shared library (.so) and the archive (.a) are both supposed to contain the same code, but in practice they might not. The first thing you should do is check if the .so really has all the symbols. The linker might have optimized some out. Use the nm utility or objdump for that purpose.

    Can you also post a console dump of the commands ndk-build is executing?

    You might also try to avoid what you’re doing, as the NDK is not really meant to produce shared libraries that depend on each other. It’s possible of course, but the recommended approach is to stuff your libs into static archives and link them directly into the resulting JNI .so.

    Edit:

    LOCAL_SRC_FILES := libtest.so seems wrong. If you want to link with a shared library, pass the library to the linker not the compiler: LOCAL_LDFLAGS += libtest.so or, even better, LOCAL_LDFLAGS += -L. -ltest

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android application. Now i have created one function which create
I have created an android application that calls (using kSOAP library) a SOAP based
I have this code for an Android application I'm trying to create into interact
I have created android application that uses Google Maps, ans it works fine here
I'm developing and android application in which I have created a ListActivity which contains
I have created a button in my Android application & I tried to set
I have a problem regarding Android App. I have created an application that download
I have an Android application that uses the Android database to create tables and
I am new to phonegap and android, I have create a hello world application
I have created my android code wherein I fetch all the data from facebook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.