CPP can't see some header file

Tommy tommylin74@gmail.com
Thu Sep 7 03:44:00 GMT 2006

Hi all,

  I use GCC 2.95.2 (sparc-leon2, for cygwin) in my win2k platform. Recently I
encountered a problem on the C preprocessor (error messages go as

source1.c: In function `_my_function1':
source1.c:185: `DEFINE_SYMBOL_NUM_001' undeclared (first use in this
source1.c:185: (Each undeclared identifier is reported only once
source1.c:185: for each function it appears in.)
make[1]: *** [OBJS/source1.o] Error 1

  This file, source1.c, is built in a directory "Src_235a". If I
change its name into "Src_235b", "Src_236a", or something different,
this error will be gone. This looks funny -- if I change the name of
directory, or change the name of some header file (defines that lost
symbol), the compiling goes okay.

  I added flags -H and -v in my CFLAGS and got the internal calling
contents of CPP (listed below):

/opt/rtems/lib/gcc-lib/sparc-rtems/2.95.2/cpp.exe -lang-c -v -I
-D__GNUC__=2 -D__GNUC_MINOR__=95 -Dsparc -D__GCC_NEW_VARARGS__ -Drtems
-D__rtems__ -D__sparc__ -D__GCC_NEW_VARARGS__ -D__rtems__ -D__rtems__
-D__sparc -D__rtems -Asystem(rtems) -Acpu(sparc) -Amachine(sparc)
-D__OPTIMIZE_SIZE__ -D__OPTIMIZE__ -g -Wall -Wpointer-arith
-Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -H
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -Asystem(embedded)
-D__leon__ -Dleon -DROMCODE source1.c

  Then I did some trials.
1. If I call CPP directly and use no arguments, I will get consistent
results for both directory "Src_235a" and "Src_235b".

2. If I call CPP using full arguments (as listed above), the dump
results go different: the "Src_235a" one doesn't include that header
file (defines symbol DEFINE_SYMBOL_NUM_001), and the other includes

  This problem can be traced till here (in CPP-level). If I duplicate
the same directory hierarchy in another win2k PC (and also use the
same LECCS-1.1.5 toolchain), it works fine and no such odd problem.

  I also tried to update cygwin libraries/DLLs and that didn't help.

  Do you have any idea to fingure out what's wrong with such a problem?


More information about the Gcc-help mailing list