【发布时间】:2017-03-30 17:23:38
【问题描述】:
我正在尝试为 Android 6 编译一个 C 程序。这是我的Android.mk:
APP_PLATFORM := android-23
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Enable PIE manually. Will get reset on $(CLEAR_VARS). This
# is what enabling PIE translates to behind the scenes.
LOCAL_CFLAGS += -fPIE -DHAVE_FANOTIFY=1 -DHAVE_SYS_FANOTIFY=0
LOCAL_LDFLAGS += -fPIE -pie
# give module name
LOCAL_MODULE := fsmon
# list your C files to compile
LOCAL_SRC_FILES := inotify.c fanotify.c util.c main.c
# this option will build executables instead of building library for android application.
include $(BUILD_EXECUTABLE)
在fanotify.c下面的include中写着:
#include <linux/fanotify.h>
当我尝试使用ndk-build时,出现以下错误:
fsmon/jni/fanotify.c:51:10: fatal error: 'linux/fanotify.h' file not found
#include <linux/fanotify.h>
^
标头fanotify.h 存在于ndk 路径/Android/Sdk/ndk-bundle/sysroot/usr/include/linux 中
有什么建议吗?
编辑:如果我尝试包含 sys/fanotify.h,则会出现同样的错误
【问题讨论】:
-
嗯好吧,
ndk-bundle/platforms/android-23/arch-arm/usr/include/linux中不存在它...我如何告诉它从 sysroot/ 使用它?
标签: android c android-ndk android.mk