arduino
arduino copied to clipboard
undefined reference to operator delete
Getting this error during compilation - seems to be related to missing libstdc++
...is there a possible solution??
I'm getting on some projects similar "delete" missing c++ issue I think I workarounded this somehow but I would like if "gornjas" or somebody would propose a better solution to this...
On 11/25/19, uXeBoy [email protected] wrote:
Getting this error during compilation - seems to be related to missing libstdc++
...is there a possible solution??
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/f32c/arduino/issues/33
If you have problems with operator delete, you should also have problems with operator new. Both are implemented in hardware/fpga/f32c/cores/f32c/new.cpp.
A simple, minimal example which can reliably provoke the error could help us pinpoint the exact problem.
I think I see the problem now... 🤦
That new.cpp does not include C++14 style 'sized deallocation' functions:
https://en.cppreference.com/w/cpp/memory/new/operator_delete
Hmm as a person who uses or cares about C++ only when shotgun-forced, I can only comment that our new.cpp was blindly cloned many years ago from (I believe): https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/new.cpp
Does your application compile with AVR arduino?
[edit]: oh, I see, we should just add delete variants which ignore the extra argument. Could you try replacing our new.cpp with the one from https://github.com/stm32duino/Arduino_Core_STM32/blob/master/cores/arduino/new.cpp
and report whether this helps?
Did some research, and I ended up just adding -fno-sized-deallocation
to the c++ compiler flags in platform.txt and that fixed it... maybe a better solution if the the added delete variants would just be dummies anyway?
I like your approach with patching compiler flags in platform.txt better, as there's no point in introducing more dummy functions which are equivalent to the existing ones, and just occupy space.
I'd leave it to Davor to check whether adding the proposed flag in platform.txt does any harm, as he's using fpgarduino much more frequently than I am, and if it doesn't break anything to proceed and commit the change.