Macros active in error messages

emre brookes brookes@uthscsa.edu
Wed Nov 25 01:09:22 GMT 2020


Florian Weimer wrote:
> * emre brookes:
>
>> I was compiling a project and received an odd message that took some
>> digging.
>> e.g.
>>
>> file.cpp:#:#: error: expected unqualified-id before numeric constant
>> # | if ( inttype == MyClass::ERROR )
>>                               ^~~~~
>> where MyClass::ERROR is an enum.
>>
>> Took some digging to find out ERROR was somewhere #define'd and the
>> cure was to #undef ERROR
>> Could never find out *where* it was defined - recursively searched all
>> include files of the project and /usr/include etc.
>> Regardless, it would have been very helpful to know in the error
>> messages that a #define was active or to have the ERROR replaced by
>> the macro substitution.
> Do you use distcc or ccache to build your project?
>
> Thanks,
> Florian
No use of distcc or ccache.
$ g++ --version
g++.exe (Rev5, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.

Thanks,
Emre



More information about the Gcc-help mailing list