public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Annoying iostream.h warning messages.
@ 1998-08-22 22:04 Viper
  1998-08-23  7:45 ` H.J. Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Viper @ 1998-08-22 22:04 UTC (permalink / raw)
  To: egcs

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. 

My older GNU g++ produced no warnings from iostream.h and streambuf.h.  I
have checked that my system include files match the include files provided
by the egcs distribution.  Am I doing something wrong to cause these
warning messages to come up?  Why should the system include files be
causing warnings.  Thanks.

Here is an example file called "test.cc":

-------------------------------------------
#include <iostream.h>

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

Now, when I compile it by typing "g++ test.cc -o test", the following
warnings are produced:

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 *'
/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 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 *'

Thanks for the help.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-22 22:04 Annoying iostream.h warning messages Viper
  1998-08-23  7:45 ` H.J. Lu
  1998-08-23  7:45 ` H.J. Lu
@ 1998-08-23  7:45 ` Carlo Wood
  1998-08-23 13:15   ` Viper
  2 siblings, 1 reply; 8+ messages in thread
From: Carlo Wood @ 1998-08-23  7:45 UTC (permalink / raw)
  To: Viper; +Cc: egcs

| 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'.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-22 22:04 Annoying iostream.h warning messages Viper
@ 1998-08-23  7:45 ` H.J. Lu
  1998-08-23  7:45 ` H.J. Lu
  1998-08-23  7:45 ` Carlo Wood
  2 siblings, 0 replies; 8+ messages in thread
From: H.J. Lu @ 1998-08-23  7:45 UTC (permalink / raw)
  To: Viper; +Cc: egcs

> 
> 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. 
> 
> My older GNU g++ produced no warnings from iostream.h and streambuf.h.  I
> have checked that my system include files match the include files provided
> by the egcs distribution.  Am I doing something wrong to cause these
> warning messages to come up?  Why should the system include files be
> causing warnings.  Thanks.
> 
> Here is an example file called "test.cc":
> 
> -------------------------------------------
> #include <iostream.h>
> 
> main()
> {
>   cout << "Hello world." << endl;
> }
> -------------------------------------------
> 
> Now, when I compile it by typing "g++ test.cc -o test", the following
> warnings are produced:
> 

Ooops. I meant to say it compiles fine on Linux with glibc 2.0.7
and libc 5.4.46.

H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-22 22:04 Annoying iostream.h warning messages Viper
  1998-08-23  7:45 ` H.J. Lu
@ 1998-08-23  7:45 ` H.J. Lu
  1998-08-23  7:45 ` Carlo Wood
  2 siblings, 0 replies; 8+ messages in thread
From: H.J. Lu @ 1998-08-23  7:45 UTC (permalink / raw)
  To: Viper; +Cc: egcs

> 
> 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. 
> 
> My older GNU g++ produced no warnings from iostream.h and streambuf.h.  I
> have checked that my system include files match the include files provided
> by the egcs distribution.  Am I doing something wrong to cause these
> warning messages to come up?  Why should the system include files be
> causing warnings.  Thanks.
> 
> Here is an example file called "test.cc":
> 
> -------------------------------------------
> #include <iostream.h>
> 
> main()
> {
>   cout << "Hello world." << endl;
> }
> -------------------------------------------
> 
> Now, when I compile it by typing "g++ test.cc -o test", the following
> warnings are produced:
> 

Which OS are you using?. If Linux, which C library are you using?
BTW, it compiles fine on Linux using glibc 2.0 and libc 5.


H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-23  7:45 ` Carlo Wood
@ 1998-08-23 13:15   ` Viper
  1998-08-23 18:16     ` Carlo Wood
  1998-08-23 23:15     ` H.J. Lu
  0 siblings, 2 replies; 8+ messages in thread
From: Viper @ 1998-08-23 13:15 UTC (permalink / raw)
  To: Carlo Wood; +Cc: egcs

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'.
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-23 13:15   ` Viper
@ 1998-08-23 18:16     ` Carlo Wood
  1998-08-23 23:15     ` H.J. Lu
  1 sibling, 0 replies; 8+ messages in thread
From: Carlo Wood @ 1998-08-23 18:16 UTC (permalink / raw)
  To: Viper; +Cc: egcs

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

Oops :/.  That happens when one uses logic like I do :).
I did read your post wrong and thought you had an error at
line 403 of iostream.h ... which made me come up with the
previous post.  Now that I see that you have the same
iostream.h as me I can only suggest to try to also use the
same glibc (2.0.7) at first.  If that doesn't help then
something must be wrong with your installation because
everything works fine here (no warnings).

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-23 13:15   ` Viper
  1998-08-23 18:16     ` Carlo Wood
@ 1998-08-23 23:15     ` H.J. Lu
  1998-08-24  4:37       ` Viper
  1 sibling, 1 reply; 8+ messages in thread
From: H.J. Lu @ 1998-08-23 23:15 UTC (permalink / raw)
  To: Viper; +Cc: carlo, egcs

> 
> 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

Please send me the output of

# gcc -M test.cc


H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Annoying iostream.h warning messages.
  1998-08-23 23:15     ` H.J. Lu
@ 1998-08-24  4:37       ` Viper
  0 siblings, 0 replies; 8+ messages in thread
From: Viper @ 1998-08-24  4:37 UTC (permalink / raw)
  To: H.J. Lu; +Cc: carlo, egcs

# gcc -M test.cc
test.o: test.cc /usr/include/g++/iostream /usr/include/g++/iostream.h \
 /usr/include/g++/streambuf.h /usr/include/g++/libio.h \
 /usr/include/g++/_G_config.h

# cat test.cc
#include <iostream>

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

Thanks for any assistance.

On Sun, 23 Aug 1998, H.J. Lu wrote:

> > 
> > 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
> 
> Please send me the output of
> 
> # gcc -M test.cc
> 
> 
> H.J.
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1998-08-24  4:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-22 22:04 Annoying iostream.h warning messages Viper
1998-08-23  7:45 ` H.J. Lu
1998-08-23  7:45 ` H.J. Lu
1998-08-23  7:45 ` Carlo Wood
1998-08-23 13:15   ` Viper
1998-08-23 18:16     ` Carlo Wood
1998-08-23 23:15     ` H.J. Lu
1998-08-24  4:37       ` Viper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).