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

Errors with max and min functions when compiling for ESP32 with Arduino IDE #1

Open
s-marley opened this issue May 3, 2019 · 4 comments

Comments

@s-marley
Copy link

s-marley commented May 3, 2019

When compiling for ESP32, errors are thrown in LEDSprites.cpp when mixing types in the min() and max() functions. I don't have the exact error to hand but if I remember correctly in each case one parameter is an int, the other a uint8_t.

This used to work, but I believe something changed in the way the ESP32 code is compiled under the Arduino environment. If anyone else has this problem, a quick fix is to replace min() and max() with _min() and _max() everywhere they appear in LEDSprites.cpp.

@veitk
Copy link

veitk commented May 6, 2019

Wow thanks for that. Was about to give up...

@Hermesfrank
Copy link

I tried the above changes, but still same result that it would not compile and I get basically the same error message, but the "_min(...)" shows instead of the original...

Am I doing something wrong? I saved a copy of the LEDSprites.cpp file, then used Notepad++ to make above changes (I think I found two occurrences of each), saved the file and started the IDE - should I be doing something further? I really want to get this running! I tried compiling both for the ESP32 Thing, and a generic ESP32 board...compiles OK for me on Arduino boards (if I use the original file)...

Thanks, Frank

@s-marley s-marley reopened this Aug 27, 2020
@s-marley
Copy link
Author

s-marley commented Aug 27, 2020

@Hermesfrank sorry, that worked for me :( not sure what elese to suggest I'm afraid. If the error messages you're getting are referencing _min(...) etc then it's obviously picking up the right file. I guess just make sure you have the latest version of ESP32 installed in boards manager (I'm running 1.0.4). Also, my setup where it compiles fine looks like this if that's any use.
image

@Hermesfrank
Copy link

Hermesfrank commented Aug 27, 2020

@s-marley Well, I continued to check this out...your comment about using the correct file made me wonder, so I looked further up into the error message and saw some reference to the "LEDSprites - Copy.cpp" file...I had just used Windows File Manage copy/paste to create the copy for safekeeping prior to editing the file and of course left it in the directory...for some reason, the compiler used/referred to the safe-file at some point...I removed the safe-file from the directory, and lo-and-behold, the sketch compiled OK! Learn something new every day, eh..

Thanks for your response and confirmation that your fix should work and that your board info and version were same as mine (and for posting in the first place!), or I would have given up in frustration...

Best regards, Frank

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

3 participants