[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Problems with abstract classes / pure virtual functio
From: |
René Liebscher |
Subject: |
Re: [avr-gcc-list] Problems with abstract classes / pure virtual functions: |
Date: |
Thu, 24 Feb 2005 08:20:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.2) Gecko/20040906 |
address@hidden schrieb:
Hi!
I got a somehow mysterious (hopefully not to silly) problem involving
abstract classes.
Here a test:
class abstract_base
{
public:
virtual void testfunction(void)=0;
virtual ~abstract_base(){} *
};
class concrete_class : public abstract_base
{
public:
void testfunction(void){}
~concrete_class(){}
};
Now I do the following:
int main(void)
{
concrete_class testobject;
}
And the Compiler warns me about:
warning: alignment of 'concrete_class::_ZTV14concrete_class' is
greater than maximum object file alignment. Using 1
warning: alignment of 'abstract_base::_ZTV13abstract_base' is greater
than maximum object file alignment. Using 1
This is normally not a problem I had this warnings all the time but
programs run withput problems.
And the Linker finally generates an error:
....h:8: undefined reference to `__cxa_pure_virtual' ( which is
actually the line marked by *)
I get this error with GCC 3.4
$avr-gcc --version
avr-gcc (GCC) 3.4.3
This is a problem in gcc 3.4.
The same program with gcc (3.3.?) didn't show this error.
-O1 should work.
For more optimization try to use the option -fno-unit-at-a-time for the
compiler.
Kind regards
Rene Liebscher
If You have any clues, why that problem shows up, please give me a hint.
Thancs a lot
Thomas