Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with Teensyduino core #70

Open
maxgerhardt opened this issue Feb 2, 2022 · 0 comments
Open

Doesn't work with Teensyduino core #70

maxgerhardt opened this issue Feb 2, 2022 · 0 comments

Comments

@maxgerhardt
Copy link

maxgerhardt commented Feb 2, 2022

Attempting to use PlatformIO with the latest version of this library and a Teensy2 (ATMega32U4) via

[env:teensy2]
platform = teensy
board = teensy2
framework = arduino
build_unflags = -fno-exceptions -std=gnu++11
build_flags = -DTEENSY_OPT_FASTEST -fexceptions -std=gnu++17
; use a more recent 7.3.0 compiler instead of 5.4.1
platform_packages =
   toolchain-atmelavr@~3.70300.0
; fill in missing parts of the standard C++ library
lib_deps =
  https://github.com/mike-matera/ArduinoSTL/archive/refs/heads/master.zip

and code src\main.cpp

#include <Arduino.h>
#include <stdexcept>
void setup(){
  Serial.begin(9600);
  try {
     throw std::runtime_error("Test test");
  } catch(const std::exception& e) {
     Serial.println(e.what());
  }
}
void loop(){
}

Results in

In file included from .pio\libdeps\teensy2\ArduinoSTL\src/memory:20:0,
                 from .pio\libdeps\teensy2\ArduinoSTL\src/char_traits:22,
                 from .pio\libdeps\teensy2\ArduinoSTL\src/string:21,
                 from .pio\libdeps\teensy2\ArduinoSTL\src/stdexcept:22,
                 from src\main.cpp:2:
.pio\libdeps\teensy2\ArduinoSTL\src/new:41:18: error: declaration of 'void operator delete(void*) noexcept' has a different exception specifier
 _UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT;
                  ^~~~~~~~
In file included from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Printable.h:26:0,
                 from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Print.h:28,
                 from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Stream.h:24,
                 from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores/usb_serial/usb_api.h:6,
                 from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/usb_api.h:2,
                 from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/WProgram.h:22,
                 from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Arduino.h:1,
                 from src\main.cpp:1:
Compiling .pio\build\teensy2\lib265\ArduinoSTL\eh_globals.cpp.o
C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/new.h:14:6: note: from previous declaration 'void operator delete(void*)'
 void operator delete(void * ptr);
      ^~~~~~~~

So cores/teensy/new.h with its declaration of

 void operator delete(void * ptr);

seems to be clashing with this library's declaration of

 _UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT;

Maybe it's possible to detect the Teensyduino core case via TEENSYDUINO global macro and not declare / define the delete operator?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant