Reputation: 21
I am having a problem when using a pre-built static library when the compiler is looking for headers.
I have a .cpp that needs to use a header file from a static library. My Android.mk is as followed :
include $(CLEAR_VARS)
LOCAL_MODULE := LibA
LOCAL_SRC_FILES := libs/libA.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := hello
LOCAL_SRC_FILES := hello.cpp
LOCAL_STATIC_LIBRARIES := LibA
include $(BUILD_SHARED_LIBRARY)
hello.cpp requires a header that can be found in the static library but the compiler says it can't find it. Do I have to have headers seperated from that static library ?
Upvotes: 2
Views: 847
Reputation: 7645
Headers are not included in static libraries. Even if they were, the compiler has no way to read a .a file, only the linker will do that.
Upvotes: 1
Reputation: 1
I'm not a prof, but I've learned that you allways need a corresponding .h-file included! In those .h-files the compiler gets the info "how to use" the libraries as they defines the functions that are inside the libs.
Good luck Martin
Upvotes: 0