[KLUG Members] ISO C++ forbids

Adam Williams members@kalamazoolinux.org
05 Aug 2002 06:38:40 -0400


I'm getting the following error:
extint.cpp:8: ISO C++ forbids defining types within return type
extint.cpp:8: return type specification for constructor invalid

when doing a "g++ -c extint.cpp".  Th referenced part of the file looks
like -

extint::extint() {
  value = 0;
 }

and the class definition looks like -

using namespace std;
class extint {
  public:
    extint();
    extint(int v);
    void operator=(int &v);
    void print(ostream *os);
    void set(int v);
    int get();
    string str();
  private:
    int value;
 }

How am I declaring a return type?  To me at least, this object doesn't
look any different than three or four other classes in this project that
compile fine.

[awilliam@estate1 XMLlpcd]$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)