Skip to content

Arduino.h: error on abs macro definition #2128

Closed
@KarateBrot

Description

@KarateBrot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions