Announcement

Collapse
No announcement yet.

How can we set the C++ runtime that gets used by Android NDK?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Hello

    Follow this step.To How can we set the C++ runtime that gets used by Android NDK?

    To add new C/C++ source files to an existing project, proceed as follows:
      1. en the Project pane from the left side of the IDE and select the Project view from the drop-down menu.
      2. Navigate to your-module > src, right-click on the main directory, and select New > Directory.
      3. Enter cpp as the directory name and click OK.
    1. Right-click on the cpp/ directory and select New > C/C++ Source File.
    2. Enter a name for your source file, such as native-lib.
    3. From the Type drop-down menu, select the file extension for your source file, such as .cpp.
      • You can add other file types to the drop-down menu, such as .cxx or .hxx, by clicking Edit File Types . In the C/C++ dialog box that pops up, select another file extension from the Source Extension and Header Extension drop-down menus and click OK.
    4. If you also want to create a header file, check the Create an associated header checkbox.
    5. Click OK.
    I hope this information will be useful for you.
    Thank you.

    Leave a comment:


  • replied
    This may help some of you: https://dawnarc.com/2019/07/ue4andro...member-of-std/

    I have an issue (https://answers.unrealengine.com/que...or-dlopen.html) that seems to be related to UE4's lack of libc++ support.

    Leave a comment:


  • replied
    Any updates on this one? This issue prevents from using third-party c++ libraries.

    Leave a comment:


  • replied
    It would be great to know if this is in the works or what steps we can take to modify the engine to make this work for us.

    Leave a comment:


  • replied
    Any update about linking libc++ instead of libgnustl?

    Leave a comment:


  • replied
    Bump.

    GCC has been deprecated since r11 (released March 2016).

    As of r18 (https://developer.android.com/ndk/do...vision_history) GCC and gnustl have been removed.

    Is there a timetable for switching Unreal Android builds to linking against libc++_shared or libc++_static instead of libgnustl_shared?
    Last edited by bh_reification; 09-21-2018, 09:24 PM.

    Leave a comment:


  • replied
    Is it possible to use libc++ instead of gnustl??

    Leave a comment:


  • replied
    darkZ, can you please elaborate how did you do that? Where is Application.mk file? Or where should it be created? Any documentation links or explanation how should c++11 compilation be enabled for Android packaging will be much appreciated.
    P.S.
    I am trying to package "game" in UE4.16.2 with elements of c++11 in the code, and so far it seems to be no way at all. Please prove me wrong.

    Leave a comment:


  • replied
    The latest version of Android Studio seems to support CMake builds instead of ndk builds hence I can't seem to use the Application.mk file. Should I be using an older version for this?

    Basically the issue I am facing is that I am not able to create a static library using the CMake build system by specifying STATIC keyword in the add_library command. It only wants to create shared libraries.

    EDIT
    Nevermind, I was able to generate a static library now. Thanks.
    Last edited by darkZ; 06-11-2017, 12:27 PM.

    Leave a comment:


  • replied
    Yeah, using static is fine unless you need the interfaces public. And yes, we've moved to c++14 now.

    Leave a comment:


  • replied
    Oh, I remember the sleepless nights when trying to make 3rd party static libraries work... To make it work all of my projects have Application.mk with such settings:

    APP_STL := gnustl_static
    APP_ABI := armeabi-v7a
    APP_CXXFLAGS := -std=c++11

    (I'm using mostly 4.14 now, for newer version you can change std to c++14, I think)

    Leave a comment:


  • replied
    The external library when compiled needs to use gnustl_shared in application.mk:

    APP_STL := gnustl_shared

    Leave a comment:


  • replied
    Originally posted by Chris Babcock View Post
    Did you include the right STL? gnustl_shared should be used.
    I see, it seems like I did not. Can your provide some help as to how to use gnustl_shared in this context?

    Leave a comment:


  • replied
    Did you include the right STL? gnustl_shared should be used.

    Leave a comment:


  • replied
    I created a simple external library with no c++11 code and I am able to link that in correctly to an Android project.
    However, as soon as I add in some c++11 code, even some std::string related code, the linking fails giving me errors which curiously look like a c++11 related problem

    This is what I get as soon as I include a function returning std::string in the external library.

    libbiksolver.a(BIK_DataTypes.cpp.obj):BIK_DataTypes.cpp:function bik_test::string_test[abi:cxx11](): error: undefined reference to 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'

    Thanks for your help!

    Best,
    darkZ

    Leave a comment:

Working...
X