Re: Can't install gcc 3.2 alongside gcc 2.96 on Red Hat 7.3

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

 



On Fri, Feb 20, 2004 at 07:39:28PM +0000, Jonathan Watt wrote:
> Claudio Bley wrote:
> 
 >The part I quoted just shows where the gcc that came with my Debian
> >distribution searches for header files by default. Redhat's default gcc
> >should behave the same. It just demonstrates that by default
> >/usr/local/include is also searched for header files.
> 
> I see, do you know why is it that when I use -v for an empty file I get 
> the following search paths:
> 
> #include <...> search starts here:
>  /usr/local/include
>  /home/jwatt/gcc/include
>  /home/jwatt/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include
>  /usr/include
> 
> but when I use -v on an actual C++ file I get more search paths, 
> specifically the following:
> 
> #include <...> search starts here:
>  /home/jwatt/gcc/include/c++/3.2.3
>  /home/jwatt/gcc/include/c++/3.2.3/i686-pc-linux-gnu
>  /home/jwatt/gcc/include/c++/3.2.3/backward
>  /usr/local/include
>  /home/jwatt/gcc/include
>  /home/jwatt/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include
>  /usr/include

If GCC is reading from standard input it can't determine the source code
type opposed to when reading a real source file where it does deduce the
source code type from the file name extension. By default GCC assumes C code
as input when it can't decuce it automatically and the user hasn't passed
the -x <language> option to GCC.

So, to force GCC to treat the code on its standard input as C++ code:

$ cat /dev/null | gcc -x c++ -E -v -

OR just use g++ when executing the command as it calls GCC with the default
language set to C++.

> Thanks for all that Claudio.

No problem. :-)
Cheers.

-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux user                         - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \

[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