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

  • SEARCH
  • Home
  • 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 9235013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:55:33+00:00 2026-06-18T06:55:33+00:00

I’m trying to compilate my own library with the Android NDK But I’ve got

  • 0

I’m trying to compilate my own library with the Android NDK But I’ve got some problems.

Here is my Android.mk file:

# Define vars for library that will be build statically.
include $(CLEAR_VARS)
LOCAL_MODULE     := MyLib
LOCAL_SRC_FILES  := ../../../src/mylib/utils/Timer.cpp
LOCAL_C_INCLUDES := ../../../src/mylib/

# Optional compiler flags.
LOCAL_LDLIBS     = -lz -lm
LOCAL_LDLIBS    := -llog  
LOCAL_CPPFLAGS  := -std=c++0x

include $(BUILD_SHARED_LIBRARY)

When I build my project with “ndk-build” I’ve got the following error :

Clean: mylib [armeabi]
Clean: stlport_shared [armeabi]
Clean: stlport_static [armeabi]
Compile++ thumb  : mylib <= Timer.cpp
jni/../../../src/mylib/utils/Timer.cpp:1:34: fatal error: mylib/utils/Timer.hpp: No such file or directory
compilation terminated.

For information, I’m including the .hpp like that :

#include <mylib/utils/Timer.hpp>

I don’t know why headers aren’t found, my library working in Xcode and eclipse.
Thanks for your time!

Edit: Here is my project’s architecture to understand my problem: https://i.stack.imgur.com/wrcAC.jpg
I’m trying to indicate where is located my “.hpp” files in the Android.mk file.

  • 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-18T06:55:35+00:00Added an answer on June 18, 2026 at 6:55 am

    Your LOCAL_C_INCLUDES should include the ../../../src/ or ../../../inc directory in order for you to use #include <mylib/utils/Timer.hpp> i.e:

    LOCAL_C_INCLUDES := ../../../src/
    

    Why don’t you put your C and C++ headers and source files inside the jni/ directory of the Android project, near the Android.mk file?

    See: What is the difference between #include <filename> and #include "filename"?

    Also this is incorrect, because the second LOCAL_LDLIBS overrides the previous LOCAL_LDLIBS directive in the current module :

    LOCAL_LDLIBS     = -lz -lm
    LOCAL_LDLIBS    := -llog  
    

    If you want to append to a make directive use:

    LOCAL_LDLIBS    := -lz -lm
    LOCAL_LDLIBS    += -llog 
    

    or LOCAL_LDLIBS := -lz -lm -llog

    EDIT:
    Using the following Android.mk it seems to work if you run ndk-build from the Android/jni directory.

    LOCAL_PATH := $(call my-dir)
    
    # first lib, which will be built statically
    #
    include $(CLEAR_VARS)
    LOCAL_MODULE     := MyLib
    LOCAL_C_INCLUDES := ../../../inc/
    LOCAL_SRC_FILES  := ../../../src/mylib/utils/Timer.cpp
    include $(BUILD_STATIC_LIBRARY)
    
    # second lib, which will depend on and include the first one
    #
    include $(CLEAR_VARS)
    LOCAL_MODULE    := MyNativeFinalSharedLib
    LOCAL_LDLIBS    := -lz -lm -llog  
    LOCAL_CPPFLAGS  := -std=c++0x
    LOCAL_STATIC_LIBRARIES := MyLib   
    include $(BUILD_SHARED_LIBRARY)
    

    Also you forgot to put LOCAL_PATH := (call my-dir) on the first line and some other missing make directives.

    An Android.mk file must begin with the definition of the LOCAL_PATH
    variable. It is used to locate source files in the development tree.
    In this example, the macro function ‘my-dir’, provided by the build
    system, is used to return the path of the current directory (i.e. the
    directory containing the Android.mk file itself).

    (from android-ndk-r8d/docs/ANDROID-MK.html)

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

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have just tried to save a simple *.rtf file with some websites and
I am trying to render a haml file in a javascript response like so:
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

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.