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 (forcing NULL value of default parameter to (void *) breaks compilation)


I have the same problem, but in my case its fatal,

g++ -c -g -O3 -fno-implicit-templates -I/usr/i586-linuxlibc5/include
-I/usr/i586-linuxlibc5/include/g++ -I. -I. -nostdinc++ fstream.cc
In file included from /usr/i586-linuxlibc5/include/g++/iostream.h:31,
                 from /usr/i586-linuxlibc5/include/g++/fstream.h:30,
                 from fstream.cc:34:
/usr/i586-linuxlibc5/include/g++/streambuf.h:403: warning: invalid type
`void *' for default argument to `ios *'
In file included from /usr/i586-linuxlibc5/include/g++/fstream.h:30,
                 from fstream.cc:34:
/usr/i586-linuxlibc5/include/g++/iostream.h:50: warning: invalid type
`void *' for default argument to `ostream *'
/usr/i586-linuxlibc5/include/g++/iostream.h: In method `int
ostream::opfx()':
/usr/i586-linuxlibc5/include/g++/iostream.h:53: warning: implicit
declaration of function `int _IO_flockfile(...)'
/usr/i586-linuxlibc5/include/g++/iostream.h: In method `void
ostream::osfx()':
/usr/i586-linuxlibc5/include/g++/iostream.h:54: warning: implicit
declaration of function `int _IO_funlockfile(...)'
/usr/i586-linuxlibc5/include/g++/iostream.h: At top level:
/usr/i586-linuxlibc5/include/g++/iostream.h:123: warning: invalid type
`void *' for default argument to `ostream *'
/usr/i586-linuxlibc5/include/g++/iostream.h:230: warning: invalid type
`void *' for default argument to `ostream *'
/usr/i586-linuxlibc5/include/g++/fstream.h: In method `class fstreambase
& fstreambase::raw()':
In file included from fstream.cc:34:
/usr/i586-linuxlibc5/include/g++/fstream.h:55: no matching function for
call to `filebuf::setbuf (void *, int)'
/usr/i586-linuxlibc5/include/g++/streambuf.h:447: candidates are:
filebuf::setbuf(char *, int)
make: *** [fstream.o] Error 1


streambuf.h:403 :    int vscan(char const *fmt0, _IO_va_list ap, ios*
stream = NULL);

regards,
Ondrej

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


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