Error compiling with GCC

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

 



Hi,

I am trying to compile a simple program in C++ and I am not obtaining.  This 
returning the following error:

[andre@antigerme poli]$ g++ test.cpp
/tmp/ccwB8kUB.o(.text+0x18): In function `main':
: undefined reference to `B::B[in-charge]()'
/tmp/ccwB8kUB.o(.text+0x2d): In function `main':
: undefined reference to `B::~B [in-charge]()'
collect2: ld returned 1 exit status
[andre@antigerme poli]$

Basically I am trying you work with polimorf in the GCC.

The simple program is:

class A {
     public:
             A();
             ~A();
};

class B: public A {
     public:
             B();
             ~B();
};

int main(void) {
      A *a;
      B b;
      a = new B();
}

Could a help me?

Thanks
[]'s




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux