gcc compiler dependency generation

Shapiro, Naum naum.shapiro@intel.com
Sat Mar 25 21:56:00 GMT 2006


Hello,

I am using GCC 3.4.3 compiler on Red Hat Linux.

My C file contains the piece of code shown bellow. The compiler variable
NAME is not defined.

#if (NAME == XXX)
#include "include_file.h"
#endif

I execute the compiler to generate the dependency file using the command
"gcc -M". The compiler command line does not contain -I option for a
directory where "include_file.h" is located. The -I is not part of the
command line because the file should not be used is NAME is not defined.

The compiler generates and error:

file.c:85:23: include_file.h: No such file or directory

Why is the compiler tries to include the "include_file.h" file even when
NAME is not defined?

Thank you for your help,

Naum Shapiro 
Staff Software Engineer
Intel Telecom Europe
Communications Infrastructure Group
Modular Communications Platform Division 
1515 Route 10
Parsippany, NJ 07054
phone: (973) 967-5122
email: naum.shapiro@intel.com


PS:
The compiler version info:

$ gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.1)



More information about the Gcc-help mailing list