smanip<int> problem (fwd)

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

 



Hello gcc-help members

I have a small program which I get compiled using gcc version 2.95.3
20010315 (SuSE) without problems. I doesn't compile for a newer version,
namely gcc version 3.3 20030226 (prerelease) (SuSE Linux). The small
program reads as follows:

#include<iomanip>
#include<iostream>

class myostream
{
  std::ostream &out;
  int mode;

public:
  myostream(std::ostream &outi, int m = 1): out(outi), mode(m)
  {
    if (mode == 1)
      out <<'@';
    if (mode == 2)
      mode=1;
  }

  myostream &operator<<(double d){
    out << d;
    return *this;
  }

  myostream &operator<<( std::smanip<int> );

};

myostream &myostream::operator<<( std::smanip<int> s)
{
  out << s;
  return *this;
}

int main(int argc, char *argv[])
{


  myostream myout(std::cout,1);
  double f = 5.675566;
  myout << std::setw(18) << f ;

  return 0;
}

Attached is the *.ii file and the output I got after compiling this small
program (let's call it test.C) with the following command:

g++ -v -save-temps -Wall  -o test test.C

Sorry for the bad way I posted this problem. I haven't done that before.

Best regards
Kevin Brinkmann

------------------------------------------------------------------
Kevin Brinkmann                   Phone:    +49 551 39 5038
				  	    +49 551 39 5036
Institut für Materialphysik
Tammannstraße 1                   Fax:      +49 551 39 5012
37077 Göttingen / Germany         E-Mail:   kbrinkm@xxxxxxxxxxx
------------------------------------------------------------------

Attachment: test.ii.gz
Description: application/gunzip

Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux
Thread model: posix
gcc version 3.3 20030226 (prerelease) (SuSE Linux)
 /usr/lib/gcc-lib/i486-suse-linux/3.3/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE test.C -Wall test.ii
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include/g++/i486-suse-linux
 /usr/include/g++/backward
 /usr/local/include
 /usr/lib/gcc-lib/i486-suse-linux/3.3/include
 /usr/i486-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-suse-linux/3.3/cc1plus -fpreprocessed test.ii -quiet -dumpbase test.C -auxbase test -Wall -version -o test.s
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ version 3.3 20030226 (prerelease) (SuSE Linux) (i486-suse-linux)
	compiled by GNU C version 3.3 20030226 (prerelease) (SuSE Linux).
test.C:25: error: `smanip' undeclared in namespace `std'
test.C:25: error: parse error before `>' token
test.C:25: error: `myostream& myostream::operator<<(...)' must take exactly one 
   argument
test.C:29: error: `smanip' undeclared in namespace `std'
test.C:29: error: parse error before `>' token
test.C:30: error: `myostream& myostream::operator<<(...)' must take exactly one 
   argument
test.C: In member function `myostream& myostream::operator<<(...)':
test.C:31: error: `s' undeclared (first use this function)
test.C:31: error: (Each undeclared identifier is reported only once for each 
   function it appears in.)

[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