Pages: [1]   Go Down
Author Topic: __cxa_pure_virtual  (Read 1130 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
Karma: 12
Posts: 3538
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Pages: [1]   Go Up
Jump to: