Skip to content

Spurious triggers of hardcoded Udp -> EthernetUdp migration error enhancement causes confusion #8385

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

Open
ghost opened this issue Jan 13, 2019 · 5 comments
Labels
Component: IDE user interface The Arduino IDE's user interface Component: IDE The Arduino IDE Type: Bug

Comments

@ghost
Copy link

ghost commented Jan 13, 2019

Arduino often calls static methods like Wifi.begin(). When reading the documentation on Arduino's WiFiSendReceiveUDPString page, if you don't pay attention to the declaration "WiFiUDP Udp" you will assume that the "Udp" in the code samples is a static class.

Not a problem though, if you don't declare "WiFiUDP Udp", you will just get an error that variable is missing, right? No. You get the error that Udp was renamed to EthernetUdp. And now you're off on a wild goose chase trying to figure out what EthernetUdp is and where to get that library.

My suggestion is either change the documentation and set "WiFiUDP udp", making it obvious that "udp" is a variable, or remove the error that says Udp has been changed to EthernetUdp and make it clear that the variable is not declared.

@matthijskooijman
Copy link
Collaborator

No. You get an error that Udp was renamed to EthernetUdp

Huh? Can you show the full error that you get? I'm wondering how that error is generated, I'm not aware of any compiler errors about "renaming" variables?

@ghost
Copy link
Author

ghost commented Jan 13, 2019

Try it yourself. Here's all you need:

void setup() {
  Udp.endPacket();
}

void loop() {

}

And you get the following error:

sketch_jan13b:3:3: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


   Udp.endPacket();

   ^

exit status 1
The Udp class has been renamed EthernetUdp.

@facchinm
Copy link
Member

This is a problem with the "fancy errors" that are handled by the IDE trying to be friendly with the user (see

if (error.trim().equals("'Udp' was not declared in this scope")) {
error = tr("The Udp class has been renamed EthernetUdp.");
msg = tr("\nAs of Arduino 1.0, the Udp class in the Ethernet library " +
"has been renamed to EthernetUdp.\n\n");
)
Some of them don't even apply anymore or are related with 0.x -> 1 transition (which happened eons ago) so getting rid of them shouldn't harm too much.
@cmaglie what should we do?

@facchinm facchinm added Component: IDE The Arduino IDE Component: IDE user interface The Arduino IDE's user interface arduino-builder The tool used to handle the Arduino sketch compilation process labels Jan 14, 2019
@cmaglie
Copy link
Member

cmaglie commented Jan 16, 2019

I guess it's time to remove them.

@per1234 per1234 changed the title Code in documentation causes confusion Spurious triggers of hardcoded Udp -> EthernetUdp migration error enhancement causes confusion Oct 1, 2020
@per1234 per1234 removed the arduino-builder The tool used to handle the Arduino sketch compilation process label Mar 28, 2021
@hilldweller2
Copy link

I know this is an old thread but it just saved me.
All I did was type Udp. instead of udp. And then my brain got hammered by an absurd incorrect error message.
Never mind, I still love Arduino to bits. It's just so (usually) user friendly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface Component: IDE The Arduino IDE Type: Bug
Projects
None yet
Development

No branches or pull requests

5 participants