T
Torsten Mueller
I have an interesting g++ compiler question.
(I know this is more a C++ language group but I think many people here
use(d) gcc.)
I specify -I. and -I../.. during the g++ invocation. But the compiler
doesn't know these paths during compilation. Why?
Look at this example:
$ g++ -v -I. -I../.. -c config.cc
The -v makes gcc dump the following list before compilation:
[...]
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/i686-pc-linux-gnu
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/backward
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include
/usr/local/include
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include-fixed
/usr/include
End of search list.
End of search list.
[...]
I have another machine where . and ../.. are truely mentioned at the top
of the list and everything is fine. But here g++ doesn't find the
headers. What could be a reason for this? I really have no idea. The
environment variables CFLAGS, CCFLAGS, CXXFLAGS, CPPFLAGS are empty.
Additional question: is -I. default or not? On the other machine, where
everything works fine, I can remove -I. and it still compiles well.
g++ 4.7.1 on Arch Linux
T.M.
(I know this is more a C++ language group but I think many people here
use(d) gcc.)
I specify -I. and -I../.. during the g++ invocation. But the compiler
doesn't know these paths during compilation. Why?
Look at this example:
$ g++ -v -I. -I../.. -c config.cc
The -v makes gcc dump the following list before compilation:
[...]
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/i686-pc-linux-gnu
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/backward
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include
/usr/local/include
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include-fixed
/usr/include
End of search list.
End of search list.
[...]
I have another machine where . and ../.. are truely mentioned at the top
of the list and everything is fine. But here g++ doesn't find the
headers. What could be a reason for this? I really have no idea. The
environment variables CFLAGS, CCFLAGS, CXXFLAGS, CPPFLAGS are empty.
Additional question: is -I. default or not? On the other machine, where
everything works fine, I can remove -I. and it still compiles well.
g++ 4.7.1 on Arch Linux
T.M.