This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Annoying iostream.h warning messages.


I am using the iostream.h that came with egcs-19980816.tar.gz. I never
installed any older or non-egcs compilers after installing egcs.  I even
cleaned out my g++ include directory before re-installing egcs, and I
still get the annoying warning messages. 

# ls -la /usr/include/g++/iostream.h
-rw-r--r--   1 root     root         9658 Aug 22 18:24 /usr/include/g++/iostream.h

# wc -l /usr/include/g++/iostream.h
    272 /usr/include/g++/iostream.h

# ls -la /usr/include/g++/streambuf.h
-rw-r--r--   1 root     root        16910 Aug 22 18:24 /usr/include/g++/streambuf.h

# wc -l /usr/include/g++/streambuf.h
    488 /usr/include/g++/streambuf.h

Here are the header files that come with egcs-19980816:

# ls -la ./egcs-19980816/libio/iostream.h
-rw-r--r--   1 root     root         9658 Sep 16  1997 ./egcs-19980816/libio/iostream.h
# ls -la ./egcs-19980816/libio/streambuf.h
-rw-r--r--   1 root     root        16910 Feb 24 12:09 ./egcs-19980816/libio/streambuf.h

If you use these same files in your system, try compiling the following:

-----------------test.cc-----------------
#include <iostream>

main()
{
  cout << "Hello world." << endl;
}
-----------------------------------------

Then type "g++ test.cc -o test".  On my system, the program compiles, but
I get issued a page of warnings:

-----------------------------------------
In file included from /usr/include/g++/iostream.h:31,
                 from /usr/include/g++/iostream:6,
                 from test.cc:1:
/usr/include/g++/streambuf.h:403: warning: invalid type `void *' for default argument to `ios *'
/usr/include/g++/streambuf.h: In method `streampos streambuf::pubseekoff(streamoff, enum _seek_dir, int = 3)':
/usr/include/g++/streambuf.h:362: warning: implicit declaration of function `int _IO_seekoff(...)'
/usr/include/g++/streambuf.h: In method `streampos streambuf::pubseekpos(streampos, int = 3)':
/usr/include/g++/streambuf.h:364: warning: implicit declaration of function `int _IO_seekpos(...)'
/usr/include/g++/iostream.h: At top level:
In file included from /usr/include/g++/iostream:6,
                 from test.cc:1:
/usr/include/g++/iostream.h:50: warning: invalid type `void *' for default argument to `ostream *'
/usr/include/g++/iostream.h: In method `int ostream::opfx()':
/usr/include/g++/iostream.h:53: warning: implicit declaration of function `int _IO_flockfile(...)'
/usr/include/g++/iostream.h: In method `void ostream::osfx()':
/usr/include/g++/iostream.h:54: warning: implicit declaration of function `int _IO_funlockfile(...)'
/usr/include/g++/iostream.h: At top level:
/usr/include/g++/iostream.h:123: warning: invalid type `void *' for default argument to `ostream *'
/usr/include/g++/iostream.h:230: warning: invalid type `void *' for default argument to `ostream *'
-----------------------------------------

Here is the version information on my Linux system:
# g++ -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.54/specs
gcc version egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)

And I use Glibc 2.0.6.

If I have bad iostream.h and streambuf.h header files, then where can I
find the good ones?  Thanks much for your help.

On Sun, 23 Aug 1998, Carlo Wood wrote:

> | When I use g++ (from egcs-2.91.54, latest snapshot) to compile even a very
> | simple "hello world" program, it results in over a page of warning
> | messages.  This becomes very annoying, especially when trying to debug
> | compiler errors for large projects that involve many different files. 
> ...
> | -------------------------------------------
> | #include <iostream.h>
> | 
> | main()
> | {
> |   cout << "Hello world." << endl;
> | }
> | -------------------------------------------
> ...
> | In file included from /usr/include/g++/iostream.h:31,
> |                  from test.cc:1:
> | /usr/include/g++/streambuf.h:403: warning: invalid type `void *' for default argument to `ios *'
> ...
> 
> You are using the wrong iostream.h.
> I suppose you use the headers of gcc-2.8 or 2.7, not egcs.
> 
> If you use a -I/usr/include/g++ then just get rid of it :).
> 
> I tested this with one of the latest egcs versions, having
> a fake iostream.h in /usr/include/g++/iostream.h, and it worked:
> the correct iostream.h was used
> (from /usr/local/egcs-cvs/include/g++/iostream.h in my case,
>  which is only 272 lines long).
> 
> Maybe you installed egcs with --prefix=/usr
> and then re-installed your "system" compiler over it?
> That is a bad idea: it would overwrite the stuff in
> /usr/include/g++
> 
> You can only have one compiler installed with --prefix=/usr
> 
> Hope this helps,
> 
> -- 
>  Carlo Wood  <carlo@runaway.xs4all.nl>
> 
> PS You might want to get used to including <iostream>
>    without '.h'.
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]