- ANDROID NDK C 11 ANDROID
- ANDROID NDK C 11 CODE
ANDROID NDK C 11 CODE
To prepare and test the code for this article, I used revision 22.0.1 of the ADT plugin and SDK tools, and revision 17 of the platform and build tools, along with revision 8e of the NDK and Eclipse Juno Service Pack 2.
An emulator or a device supporting OpenGL ES 2.0. ANDROID NDK C 11 ANDROID
The Android SDK & NDK installed, along with a suitable IDE. obj/local/armeabi/libhello-jni.soĪnd check output of command ~/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86/bin/arm-linux-androideabi-nm -C ~/android-ndk-r9b/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/libgnustl_static.For this first post in the Developing a Simple Game of Air Hockey Using C++ and OpenGL ES 2 for Android, iOS, and the Web series, we’ll create a simple Android program that initializes OpenGL, then renders simple frames from native code. obj/local/armeabi/objs-debug/hello-jni/HelloJni.o ~/android-ndk-r9b/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/libgnustl_static.a -lgcc -no-canonical-prefixes -Wl,-no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L~/android-ndk-r9b/platforms/android-17/arch-arm/usr/lib -llog -lc -lm -o. One thing to check: run ndk-build V=1 and make sure that the link step is similar to ~/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libhello-jni.so -shared -sysroot=~/android-ndk-r9b/platforms/android-17/arch-arm. Return env->NewStringUTF("Hello from JNI !") Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, _android_log_print(ANDROID_LOG_DEBUG, "HelloJni", "hello from thread.") Here's my minimal Android.mk: LOCAL_PATH := $(call my-dir)Īpplication.mk APP_CPPFLAGS := -std=c++11Īnd here is the minimal HelloJni.cpp #include I'm sorry, the following should have been a comment, not answer - because I don't know what's wrong in your code, but here is what you can do to figure out yourself: Any help would be appreciated!ĮDIT: If I print _cplusplus it shows 201103L, so it looks like it's using the correct version. I've read many topics on getting C++11 to compile but nothing seems to work, I believe I've missed something but can't figure out what it is. This also happens with other features I am trying to use (std::unique_ptr, std::shared_ptr, std::move() e.t.c). Everything compiles fine without any C++11 features, and including something like or doesn't cause any complaints, however when actually creating a std::thread object I get "Type 'std::thread' could not be resolved". I have one C file (jni.c) and a couple of test cpp/hpp. (ndk path)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include I have ensured that Eclipse has the following paths in C++ general->Paths and Symbols (ndk path)/sources/cxx-stl/gnu-libstdc++/4.8/include I have tried setting the following too without luck: LOCAL_CFLAGS := -D_GXX_EXPERIMENTAL_CXX0X_
LOCAL_CPPFLAGS := -std=c++11 -pthread -frtti -fexceptions Here is my Android.mk: LOCAL_PATH := $(call my-dir)įILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp) Here is my Application.mk: NDK_TOOLCHAIN_VERSION := 4.8 Compiling without C++11 features works fine. I'm trying to compile some C++11 code using NDK r9b, however no matter what I try it doesn't work.