-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add include guards instead of #pragma once #171
Comments
Any more details on why this happens? Does ArduinoCore-samd define its own version of the Udp class somehow and using the same include guards on both ensures only one of them is added? If so, I think that would be fragile, since depending on include ordering you might get one or the other definition? |
https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/Udp.h |
Sounds like this is really a bug in ArduinoCore-samd and that the Udp.h should be removed from there? |
I just checked, core-stm32 and core-avr have the same problem. Of course deleting it in arduino-core would be the most efficient but I am not sure what problems that could cause. |
I think those other two cores do not include ArduinoCore-API yet (they just duplicate everything, from before ArduinoCore-API existed). When you say "the same problem", do you mean you get the same errors? Or just that they contain an Udp.h (since the latter is to be expected)?
Seems like that would be the proper solution here, and if the include paths are set up correctly so |
They both contain an Udp.h if you say that is to be expected I trust you. I'm not sure what arduino's design decisions where or are. |
It's just that originally ArduinoCore-API did not exist and each core would duplicate all hardware-independent code. Then Arduino-Core-API was invented to house all this independent code, but not all cores have been modified to include ArduinoCore-API yet, so at least the AVR core still contains all of the independent code directly, instead of including ArduinoCore-API, which is why it is expected that Udp.h is in there, but not in ArduinoCore-samd. |
ArduinoCore-API/api/Udp.h
Line 35 in e26862e
#Pragma once instead of include guards causes
error: redefinition of 'class arduino::UDP'
with the ArduinoCore-samd.An easy fix would be to add:
Or remove the double class definition
The text was updated successfully, but these errors were encountered: