finding where a macro is redefined

John Love-Jensen eljay@adobe.com
Wed Feb 14 08:36:00 GMT 2007


Hi Trevis,

> Any suggestions for more speedily tracking this problem down?

I use the output from GCC.

For example...

: cat test.cpp
#define FOO 9
#define FOO 8

: g++ -DFOO -c test.cpp
test.cpp:1:1: warning: "FOO" redefined
<command line>:1:1: warning: this is the location of the previous definition
test.cpp:2:1: warning: "FOO" redefined
test.cpp:1:1: warning: this is the location of the previous definition

I can see that line 1 of test.cpp redefines FOO, which was previously
specified on the command line.

Also, line 2 of test.cpp redefines FOO, which was #define'd (or really,
re#define'd) previously on line 1.

HTH,
--Eljay



More information about the Gcc-help mailing list