undefined reference to `operator delete(void*, unsigned int)'
Hi,
The following C++ code doesn't link in Crossworks for ARM 3.7.7, with the GNU++14 option selected:
---------- THE CODE -----------
class Something
{
public:
virtual ~Something() {}
virtual void Do_Something() = 0;
};
class More_Something : public Something
{
public:
~More_Something() {}
void Do_Something() override {}
};
More_Something something;
------------ THE ERROR MESSAGE -----------
Firmware ARM Debug/main.o: In function `Something::~Something()':
undefined reference to `operator delete(void*, unsigned int)'
Firmware ARM Debug/main.o: In function `Something::~Something()':
undefined reference to `operator delete(void*, unsigned int)'
Firmware ARM Debug/main.o: In function `More_Something::~More_Something()':
undefined reference to `operator delete(void*, unsigned int)'
Firmware ARM Debug/main.o: In function `More_Something::~More_Something()':
undefined reference to `operator delete(void*, unsigned int)'
----------
If I remove the "virtual" from the base class, everything links just fine, but I don't want to do that since that would lead to broken and/or non platform independent code.
Another way around the problem seems to be to add the following line in the base class:
void operator delete(void *) { assert(0); }
But as I want to keep this part of the code platform independent, I wouldn't like to do that either.
Is there a way around this issue?
Please sign in to leave a comment.
Comments
0 comments