[En-Nut-Discussion] C++ compiling problem with virtual methods(aligment of 'x' is greater than maximum object file aligment)
Ernst Stippl
ernst at stippl.org
Fri Feb 23 08:31:53 CET 2007
Hi!
Try to post you questions also at avr-gcc-list at nongnu.org as this is the avr
gcc forum. The people there are very knowledgable!
regards
ernst
-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Gervasio Varela
Gesendet: Donnerstag, 22. Februar 2007 22:15
An: ethernut at stockelache.de; Ethernut User Chat (English)
Betreff: Re: [En-Nut-Discussion] C++ compiling problem with virtual
methods(aligment of 'x' is greater than maximum object file aligment)
Hi Matthias,
welcome to the club of C++ programmers on Ethernut.
> Since I do not have v1 Charon board I can not say what is going wrong.
> However regarding Ethernut 3 (arm) I did some adaptation and so far as
> I know PURE virtual functions are not supported in current version.
After an afternoon of tests, I have come to the conclusion that in AVR-GCC
pure virtual functions aren't supported neither :).
However
> I remember I had some problems also with virtual functions, but when I
> remember right that was during linking.
>
I guess with some modifications in the makefiles (compiler / linker flags)
> it should be possible.
Yes, at last I managed to find the file with the avr-g++ flags defintions
and I removed the '-Wall -Werrror' in order to achieve that the compilation
process doesn't get stoped by those warnings.
Now the program compiles and links well (but the warnings continue there),
and even runs well! :) (virtual functions are running ok)
My primary concerns were about the size of the resulting program (I'm
implementing a sort of remote object system for little embedded systems),
but it seems to scale well, even for the 128K ROM of the Charon2 :D.
OK - not at all very helpful my words - just a comment.
Thank you very much Matthias.
Finally, some of my first impresions testing C++ with AVR-GCC, to see if
some are incorrent (I have little experience with C++) and somebody knowns a
tip about it:
- You can't use PURE virtual functions
- You can't use new or delete with arrays (ex: SomeObject * foo = new
SomeObject[len]; delete [] foo), use malloc and free instead?
Best regards.
--
###################################
# Gervasio Varela #
# gervarela at picandocodigo.com #
# http://www.picandocodigo.com #
###################################
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/693 - Release Date: 19.02.2007
17:01
More information about the En-Nut-Discussion
mailing list