ESP8266: "error: 'abs' cannot be used as a function"

I have a huge-ish application that has to run on both AVR and ESP. No problem compiling for AVR, but when compiling for ESP, the below line throws "error: 'abs' cannot be used as a function".

curStepDelay = (100000UL / abs(gaugeTargetPos - gaugeCurPos)) / 1000;
                                                                                             ^

I cannot understand why.... Both gaugeTargetPos and gaugeCurPos are declared as ints. AFAICT, abs is defined as:

#define abs(x) ((x)>0?(x):-(x))

VS Intellisense shows abs expands to:

((gaugeTargetPos - gaugeCurPos)>0?(gaugeTargetPos - gaugeCurPos):-(gaugeTargetPos - gaugeCurPos))

That all looks perfectly legit to me. So why the error? Is this just a quirk/bug of this version of the ESP compiler?

This is actually not a problem for me, since this class is not needed on the ESP implementation, but I am curious why this error occurs, just in case it comes up again in the future, since I will be using the ESP a lot for a while.

Regards,
Ray L.

Can you reproduce the problem with a small program that you can post here ?

Oddly, no. A simple program containing little more than the offending line compiles just fine. That makes this smell like some bizarro build system or compiler bug, doesn't it?

Regards,
Ray L.

Can you post the full error message.
It seems like abs is a valid identifier but it is not a macro nor function.

Don't use abs, include and use std::abs.

Pieter