Header file not found only in separate translation unit

I am currently stuck in compiling on Android for my application.

I get the following error while compiling my native library with ndk-build :

 BackgroundDisplayConfiguration.h:12:23: fatal error: glm/glm.hpp: No such file or directory #include <glm/glm.hpp> ^ 

What puzzles me is that I indicated the path for this library for headers only in my Android.mk as follows:

 LOCAL_CPPFLAGS += -I../../glm/include 

and this path exists and is correct, but also, if I messed up this path, I get the same error in other files that include glm.hpp . When the path is correct, only this file gives an error, and I do not understand why. Any pointers?

EDIT: Well, that is even more puzzling. The include parameter appears in every compiler command for each file, but not in the compiler command for the large shell generated by swig (which prints my library_native_wrap.o ), and that where it gives an error ... Well, this is at least explains observed behavior.

+5
source share
1 answer

So, I found a workaround for this, although this is not entirely correct.

In fact, I found out that when compiling each source of my library, the compiler command actually had an include parameter, but then when the output of swig (this large unique C ++ shell file) was compiled, there was no longer any option.

I found a way to fix this by adding my include path to LOCAL_EXPORT_C_INCLUDES .

For some reason, LOCAL_CPPFLAGS not used when compiling the shell ...

+3
source

Source: https://habr.com/ru/post/1203285/


All Articles