On some systems abs() and others such as min() and max() are implemented as preprocessor macros. To see if that's the case for you, add the line
#undef abs
after this line:
#include <cstdlib>
The preprocessor has no respect for namespaces and will blindly substitute its definition of abs into your source code before it's fed to the compiler even if the result is syntactic chaos.