Question

i wrote a simple C++ Programm using NDK, and it works fine. Now I want to add the following header file for using logging functions:

android\log.h

My Android.mk look like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS:= -llog

LOCAL_MODULE    := ndkmodulea
LOCAL_SRC_FILES := ndkmodulea.cpp

include $(BUILD_SHARED_LIBRARY)

My .cpp file starts like this:

#include <jni.h>            
#include <string.h>
#include <android\log.h>

if i try to run ndk-build (via terminal) inside the android project folder, I'll get following error message:

Compile++ thumb  : ndkmodulea <= ndkmodulea.cpp
jni/ndkmodulea.cpp:4:25: fatal error: android\log.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/ndkmodulea/ndkmodulea.o] Error 1

Can somebody help or teach me how to correctly include such header files? Many thanks in advance!

Was it helpful?

Solution

Use forward slashes in #include paths:

#include <android/log.h>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top