Skip to content

Arduino.h: error on abs macro definition #2128

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
KarateBrot opened this issue Nov 30, 2018 · 0 comments · Fixed by #2738
Closed

Arduino.h: error on abs macro definition #2128

KarateBrot opened this issue Nov 30, 2018 · 0 comments · Fixed by #2738

Comments

@KarateBrot
Copy link

KarateBrot commented Nov 30, 2018

Hardware:

Board: NodeMCU 32-S
Core Installation/update date: v1.0.0
IDE name: PlatformIO
Computer OS: Windows 8.1

Description:

It seems like I have got a similar issue to issue #1734. Somehow the macro definition of abs inside Arduino.h collides with the std::abs function inside the cmath library.

Debug Messages:

In file included from src\PowerSupply.h:22:0,
from src\PowerSupply.cpp:11:
src\PowerSupply.cpp: In member function 'void Heater::calibrate()':
C:\Users\Jan Post\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:76:16: error: expected unqualified-id before '(' token
#define abs(x) ((x)>0?(x):-(x))
^
src\PowerSupply.cpp:190:15: note: in expansion of macro 'abs'
while (std::abs(current - 10.0) > 1.0 && std::abs(currentLast - 10.0) > 1.0) {
^
C:\Users\Jan Post\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:76:16: error: expected unqualified-id before '(' token
#define abs(x) ((x)>0?(x):-(x))
^
src\PowerSupply.cpp:190:49: note: in expansion of macro 'abs'
while (std::abs(current - 10.0) > 1.0 && std::abs(currentLast - 10.0) > 1.0) {
^
*** [.pioenvs\nodemcu-32s\src\PowerSupply.cpp.o] Error 1
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