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

#include <new.h> vs #include <new>? #20

Closed
SteveEisner opened this issue May 2, 2022 · 3 comments
Closed

#include <new.h> vs #include <new>? #20

SteveEisner opened this issue May 2, 2022 · 3 comments

Comments

@SteveEisner
Copy link

SteveEisner commented May 2, 2022

I was trying to compile an Arduino app on Teensy 4.0. With Teensy 3.X I've been using ustd by defining __ATMEGA__ and it worked OK.

As far as I can tell, Teensy 4.0 uses an updated Arduino Core that no longer exposes <new.h>
See: https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/new.h for example, that suggests that core moved away from using this file. I guess the Teensy 4 doesn't even bother to try to offer this stub.

As a result, the compile fails with:

In file included from .platformio/lib/ustd/ustd_array.h:31:0,
.platformio/lib/ustd/ustd_platform.h:113:51: fatal error: new.h: No such file or directory

But it does work when I change it to:

#include <new>

Would that be an appropriate update to https://github.com/muwerk/ustd/blob/master/ustd_platform.h#L113 ? Or possibly to expose a new platform #define that controls the behavior?

@domschl
Copy link
Member

domschl commented May 2, 2022

I've added a new platform define __TEENSY40__, which should use the proper memory allocation routines of the ARM M7 core. Since I don't have the hardware, I would be grateful, if you could check if it now works? If there are no problems, I would publish a new release 0.7.1.

@domschl
Copy link
Member

domschl commented May 3, 2022

Release 0.7.1 with Teensy 4.0 support is published. Thank You!

@domschl domschl closed this as completed May 3, 2022
@SteveEisner
Copy link
Author

Thanks so much for such a fast response!
I use platform.io to include your library, and I'm not seeing 0.7.1 show up there yet - but I did clone master into my project and confirm that it compiles correctly with the new __TEENSY40__. I'll test it on a real board ASAP just to make sure the runtime works correctly but I can't imagine there being any problem.

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

2 participants