Skip to content

Official EthernetClient Sample Not Compiling - Ambiguous overload error with latest Arduino 1.0.6 #2611

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

Closed
OzmoOzmo opened this issue Feb 9, 2015 · 6 comments · Fixed by #2618
Assignees
Labels
Component: Documentation Related to Arduino's documentation content

Comments

@OzmoOzmo
Copy link

OzmoOzmo commented Feb 9, 2015

The code sample below - the official Arduino sample code.
will not compile:

    http://arduino.cc/en/Reference/ServerAvailable

My public code libraries use the EthernetClient library like this - and same method I used is mentioned in several books and several ethernet sources - but it will not compile anymore on 1.0.6

(I have tried official 1.0.6 and the nightly build ARDUINO 1.6.0rc3 - 2015.02.03)

The problem is EthernetClient cannot be tested for true/false anymore (it used to have a overloading that allowed you to query it being ready by using boolean comparitor).

The sample code has not worked since 1.0.5

Official Sample Code:

EthernetClient client = server.available();
if (client == true) { //compiler error here
}

What is the correct new way to do this test now - and will the documentation be changed or the IDE/Compiler be changed back (best option)?

Thanks very much.

@ffissore
Copy link
Contributor

Hi, the code is wrong. We'll fix it asap. Correct syntax is if (client) {

@ffissore ffissore added the Component: Documentation Related to Arduino's documentation content label Feb 10, 2015
@OzmoOzmo
Copy link
Author

I think might be better fix in library code if possible than update documentation...

Several printed media is currently showing the way it worked in 1.0.5

eg. page 163 of this book.

https://books.google.co.uk/books?id=yvclBgAAQBAJ&pg=PA163&lpg=PA163&dq=arduino+"if+%28client+%3D%3D+true%29"

And this book (Non-English language)
https://books.google.co.uk/books?id=LwLzAwAAQBAJ&pg=PA185&dq=arduino+"if+%28client+%3D%3D+true%29"

And there are a lot of apps and code samples using the old way - this search shows it will break a lot out there unnecessarily.
https://www.google.co.uk/search?q=if+(client+%3D%3D+true)#q=%22if+(client+%3D%3D+true)%22

@ffissore
Copy link
Contributor

You're right. I've proposed a change in #2618. Please leave your comment

@ffissore
Copy link
Contributor

Please try one of the IDEs at #2618 (comment)

@agdl
Copy link
Member

agdl commented Feb 20, 2015

@OzmoOzmo corrected in the reference. Can i close this issue?

@OzmoOzmo
Copy link
Author

Thanks very much - that does indeed sort that problem.

Sorry not getting back to you sooner - but I was trying to get the whole
project compiling to fully test it

  • still having trouble converting depreciated memory functions like
    const prog_uchar allmonths[] = {"JANFEB..."} etc.

But thanks for getting EtherClient working anyway :)

On Fri, Feb 20, 2015 at 12:10 PM, Arturo Guadalupi <[email protected]

wrote:

@OzmoOzmo https://github.com/OzmoOzmo corrected in the reference. Can i
close this issue?


Reply to this email directly or view it on GitHub
#2611 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation Related to Arduino's documentation content
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants