How do I resolve file name conflicts in GCC?

I have two header files named string.h

in different libraries, they conflict with each other and even conflict with the standard C include file of the same name.

There is no need to use any other string.h

than the standard one, but I need to include the library header paths in the GCC search path. Currently I'm using something like -I /usr/local/include/lib1 -I /usr/local/include/lib2

, but this way I can not include a standard the C string.h

.

What is the correct way to resolve such conflicts?

+2


a source to share


2 answers


Maybe you can use #include <lib1/string.h>

and compile with gcc -I/usr/local/include

.



+5


a source


The problem is that directories added to the search path via -I are scanned before the standard ones, which are for gcc (ok)

/usr/local/include/
/usr/include/
/usr/local/lib/
/usr/lib/

      



So, you can follow Schnouki's advice, except there is no need to add -I / usr / local / include

+3


a source







All Articles