Neha Shukla
Neha Shukla

Reputation: 3660

Adding external .h files to NDK project in Windows

I have added ndk plugin in Eclipse.

I have imported a NDK project in Eclipse.

But projects requires external .h file from the system, so I have added that folder where .h files files resides by

right click on project-> c/C++ General->Paths and symbols->then click on  
include and then click add and given path of that folder 

also checked all configurations and all languages.

still when I build the project from Command prompt by moving to path where my project is , then ndk-build I am getting for .h file no such file or directory error.

How can I resolve this issue??

Please help...

Upvotes: 0

Views: 292

Answers (2)

ph0b
ph0b

Reputation: 14463

what you did to add the reference the external headers was only for eclipse, so it correctly resolves all the symbols and files references.

You also need to properly add a reference to these .h inside your ndk configuration files, ie inside Android.mk.

Use LOCAL_C_INCLUDES := path/to/headers in your module, like in this sample Android.mk file:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES := main.c
LOCAL_MODULE := mymodule
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../includes

include $(BUILD_SHARED_LIBRARY)

If your .h files are part of a prebuilt module your own module depends on, use LOCAL_EXPORT_C_INCLUDES inside the prebuilt module instead of LOCAL_C_INCLUDES inside yours.

Upvotes: 0

user3161880
user3161880

Reputation: 1055

Please refer to documentation of LOCAL_C_INCLUDES variable

Upvotes: 2

Related Questions