Forum 2005-2010 (read only)
Bugs & Suggestions
(Read 1 time)
Apr 05, 2008, 11:08 am
Prior to version 11 I wrote a couple of small frameworks using pure virtuals. In order for this to work I had to define:
extern "C" void __cxa_pure_virtual();
Just upgraded to version 11, and found that __cxa_pure_virtual is now declared for me. Trouble is, it is declared WRONG, without the extern "C". The compiler complains because the declarations don't match. If I remove the 'extern "C"', then the reference is not found by the linker and that dies.
I've worked around it by defining the library CppStubs and moving my definition of __cxa_pure_virtual (and delete) into there. Probably a better place for it anyhow.
But you might want to fix the declaration of __cxa_pure_virtual.
Location: Cambridge, MA
Apr 07, 2008, 02:14 am
I didn't even know you could use virtual functions with avr-g++. Does it actually work?
There's certainly no explicit definition of __cxa_pure_virtual in the Arduino source code. Do you know where it's defined?
Do you have a small, complete example of a sketch or program that use virtual functions?