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 6924643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:41:19+00:00 2026-05-27T10:41:19+00:00

I have been trying to marry Boost and android on windows for long time

  • 0

I have been trying to marry Boost and android on windows for long time and tried lot of approaches but still no luck. I want to make a sample program using Boost library in android. I am following this tutorial here.

As this tutorial suggested i have kept my Boost lib in ****(Android NDK)\sources\boost_1_44_0**** compiled it successfully.

Then i made an Android.mk file inside sources/boost_1_44_0 and made the entry of each library which i want to use. In this case lib. file is libboost_date_time-gcc-mt-s-1_44.a available in boost_1_44_0/android/lib/
Here is the content of Android.mk file.

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= boost_date
LOCAL_SRC_FILES:= boost_1_44_0/android/lib/libboost_date_time-gcc-mt-s-1_44.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(PREBUILT_STATIC_LIBRARY) 

Now the next step is to make an Android.mk file in my project directory, inside jni folder.(this is to create a shared library.). Here are its contents.

LOCAL_PATH := $(call my-dir)
 include $(call all-subdir-makefiles)

include $(CLEAR_VARS)

# Here we give our module name and source file(s)
LOCAL_LDLIBS := -llog -ldl
LOCAL_MODULE    := ndkfoo
LOCAL_SRC_FILES := ndkfoo.cpp
LOCAL_STATIC_LIBRARIES := boost_date
include $(BUILD_SHARED_LIBRARY)
$(call import-module,boost_1_44_0) 

Here is the Application.mk file placed on the same location, inside jni folder. Contents of Application.mk file are as follows:

APP_STL      = gnustl_static #(or APP_STL = stlport_static as required)
APP_CPPFLAGS = -fexceptions  

And finally here is my ndkfoo.cpp file

#include <string.h>
#include <jni.h>
#include <stdio.h>
#include <boost/date_time.hpp>

using namespace boost::gregorian;

void Java_com_ndkfoo_NdkfooActivity_invokeNativeFunction(JNIEnv* env, jobject javaThis) {
    date weekstart(2002,Feb,1);

}

this program might be incorrect but the problem is that it does not recognize any boost headers or function. and i always get compilation error.

Is there something i am missing or doing incorrectly? Any help would be really appreciated.

EDIT: This question contains everything you would need to include Boost library in android. For more tips look at my answer below. Hopefully this would also work for you.

Thanks.

  • 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-05-27T10:41:20+00:00Added an answer on May 27, 2026 at 10:41 am

    My question contained almost complete steps for including BOOST library in Android. But still there are some important points you should remember while working with this.

    • Delete auto generated obj and libs folder Each time before you compile your native code.

    • If you are going to write your native code in C++, add LOCAL_CPP_EXTENSION := .cpp to your Android.mk(jni/Android.mk) file.

    • if you are going to code in C++, put your all cpp code inside extern "C" {}.

      extern C { /*cpp code*/ }

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

Sidebar

Related Questions

Have been trying the whole day long and googled the **** out of the
I have been trying to get right solution / answer for my issue, still
I have been trying to create a directory in /sdcard programmatically, but it's not
I have been trying forever but it is just not working, how can I
I have been trying for a while now, but I can't figure out how
i have been trying to apply the Gridview Tutorial but i'm stuck in an
Have been trying to write an awk script which processes a log file, but
I have been trying to use the Windows SDK v7.1 in Qt Creator without
I have been trying for last 3 days still i am not able to
I have been trying to create a torrent site but I'm stuck with the

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.