DarkZeros
DarkZeros

Reputation: 8410

Android NDK: "fatal error: 'thread' file not found"

I am trying to compile a NDK only app (command line app). I was using C++11 for many things, and I recently added threads:

#include <thread>

Now my compilation is not working, even though it works for map/deque/vector/.... With the following error:

jni/common.h:24:10: fatal error: 'thread' file not found
#include <thread>
         ^
1 error generated.

This is my Application.mk:

APP_PLATFORM := android-18
APP_CPPFLAGS := -Wall -frtti -fexceptions -fpermissive
APP_ABI := armeabi-v7a

APP_STL:=stlport_static
NDK_TOOLCHAIN_VERSION := clang
APP_OPTIM := release

This is my Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE     := XXXX

LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/XXXXX

LOCAL_SRC_FILES  := ....

LOCAL_C_FLAGS   := -O3 -std=c++11
LOCAL_CXX_FLAGS := -O3 -std=c++11

LOCAL_LDLIBS    := -llog

include $(BUILD_EXECUTABLE)

I am using NDK 10d.

Upvotes: 1

Views: 5216

Answers (1)

DarkZeros
DarkZeros

Reputation: 8410

Ok, I'll answer myself :)

Seems that APP_STL:=stlport_static does not support C++ threads. Changing to the APP_STL:=gnustl_static solves the problem.

Upvotes: 6

Related Questions