Skip to content Skip to sidebar Skip to footer

Android Can't Include Linux In C Program With Android.mk

I'm trying to compile a C program for Android 6. This is my Android.mk: APP_PLATFORM := android-23 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Enable PIE manually. Will ge

Solution 1:

You can specify additional include paths for your module using LOCAL_C_INCLUDES.

LOCAL_C_INCLUDES := /Android/Sdk/ndk-bundle/sysroot/usr/include/

https://developer.android.com/ndk/guides/android_mk.html#mdv

Solution 2:

The NDK historically didn't backport headers to old releases, but we've reworked things in r14 so this is possible: https://android.googlesource.com/platform/ndk/+/ndk-r14-release/docs/UnifiedHeaders.md

By default in r14 you still get the old form of the headers. The new "unified headers" have the headers you're looking for. If you want to try unified headers, set APP_UNIFIED_HEADERS := true in your Application.mk (settings for other build systems can be found in the link above).

In r15 (first beta due out soon), the default has changed to the new headers, and the option for disabling them has changed (see the same doc in r15 for changes in options: https://android.googlesource.com/platform/ndk/+/ndk-r15-release/docs/UnifiedHeaders.md).

Post a Comment for "Android Can't Include Linux In C Program With Android.mk"