Re: compile errors from gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



D Macean wrote:
It has always been a mystery to me where the header files come from
Maybe this is a mystery for many GCC users, at least "how to get GCC to tell
where it will search the headers as default" is a question which is hard to answer....

The somehow-known "-print-search-dirs" GCC option only shows the "programs"
(cc1*, collect2, as, ld etc) and libraries search paths, but the clue here is "which component of GCC would need the headers?" Of course it is the "C preprocessor" aka "cpp", not "gcc" or "g++" in C++ case. So one should experiment with the 'cpp' command ! The obvious 'cpp -print-search-dirs' however is a disappointment but the quite common '-v' should give a better result, but stopping during its run and then
waiting some input from the keyboard (stdin) :-(   A Ctrl-C helps...

Nowadays the "real cpp" is moved into those 'cc1' and 'cc1plus' programs and if one tries them directly, also they should tell those headers search paths with the
'-v' option... And will stop in their output.

When only that 'cpp' is available, it could be expected that there is some "standard" way to see the headers search paths with it... But surprisingly there isn't :-(

In old GCCs giving commands to the preprocessor via the '-Wp,<command>' was
the way and a :

 gcc -Wp,-v

worked with C and a :

 gcc -Wp,-v,-lang-c++

worked with C++ -- to give those headers search paths without really "compiling" anything... Nowadays when knowing that 'cc1plus' will also be the "preprocessor"
with C++, one can try something like :

  `gcc -print-prog-name=cc1plus` -v

in order to get the 'cc1plus' associated with the 'gcc' (whereever it then is) to be run with that needed '-v' option and then it telling the C++ and C headers search paths...

Complicated, could someone say :-(  These things could really be easier...

Of course during a real compile with 'gcc' or 'g++' using a '-v' will give its verbose
output, including the headers search paths but something similar with the :

  gcc -print-search-dirs

option could be expected also for the headers and the :

 cpp -print-search-dirs

could be the chosen command for the headers....



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux