Skip to content

Arduino.h: error on max macro definition #1734

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
Sauro98 opened this issue Aug 6, 2018 · 0 comments · Fixed by #1783
Closed

Arduino.h: error on max macro definition #1734

Sauro98 opened this issue Aug 6, 2018 · 0 comments · Fixed by #1783

Comments

@Sauro98
Copy link

Sauro98 commented Aug 6, 2018

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: up to date as of 06/08/2018
IDE name: VSCode
Flash Frequency: 80Mhz
Upload Speed: 921600

Description:

I am working with a TTGO esp32 module and I'm using vectors in my code, and it compiled fine up to a certain point. Then, out of the blue, it suddenly started giving me this error when trying to upload the code to the board:

c:\users\ivano\documents\arduino\hardware\espressif\esp32\tools\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0\bits\stl_vector.h: 
In member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_M_check_len(std::vector<_Tp, _Alloc>::size_type, const char*) const':

C:\Users\Ivano\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Arduino.h:182:18: error: expected unqualified-id before '(' token

 #define max(a,b) ((a)>(b)?(a):(b))

To get it to compile again I had to undefine min and max after including Arduino.h

#include <Arduino.h>
#undef min
#undef max

It might be worth noting that I'm also including vector in another file but commenting that include out did not change the problem.

Is there a reason why this should happen?

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

Successfully merging a pull request may close this issue.

1 participant