This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A problem with include_next and removing duplicated include paths
- To: gcc at gcc dot gnu dot org
- Subject: A problem with include_next and removing duplicated include paths
- From: Andrey Slepuhin <pooh at msu dot ru>
- Date: Wed, 25 Jul 2001 00:44:11 +0400
- Cc: mark at codesourcery dot com
Hi folks,
Sorry if this problem was already discussed, but I consider current behavior
of gcc preprocessor very strange. Consider the following situation:
I'm writing a C++ program which also uses some library libfoo. To get
include flags needed to use libfoo headers correctly, I'm using a
script 'libfoo-config --cflags' (this is, for example, a common thing
for most GNOME libraries). So, if libfoo is installed under /usr prefix,
I will probably get -I/usr/include in gcc command line. Then a "clever"
preprocessor removes duplicated include paths (the second /usr/include
is a system default), so the remaining /usr/include will be _before_
libstdc++ include paths and include_next directives used in libstdc++
will not work (because they assume system include path _after_
libstdc++ one). Such situation is true at least for a week old
gcc-3.0.1 snapshot. So I have two questions:
1) Is it correct behavior of preprocessor to remove duplicated
include paths?
2) If 1) is correct, what is the correct solution for a problem described?
Regards,
Andrey
--
A right thing should be simple (tm)