br
$ which cc
/usr/local/bin/cc

$ cc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.1/configure --enable-languages=all
Thread model: posix
gcc version 4.0.1

$ cc main.c

$ cc -I/usr/local/include -I/usr/X11R6/include main.c
main.c: In function 'main':
main.c:3: error: 'my_type' undeclared (first use in this function)
main.c:3: error: (Each undeclared identifier is reported only once
main.c:3: error: for each function it appears in.)
main.c:3: error: syntax error before 'i'

$ cat main.c
#include <my_header.h>
int main(){
my_type i;
return 0;
}

$ cat /usr/local/include/my_header.h
#define my_type int

$ cat /usr/X11R6/include/my_header.h

$ cc -I/usr/local/include -I/usr/X11R6/include main.c -Wall -save-temps
main.c: In function 'main':
main.c:3: error: 'my_type' undeclared (first use in this function)
main.c:3: error: (Each undeclared identifier is reported only once
main.c:3: error: for each function it appears in.)
main.c:3: error: syntax error before 'i'

$ cat main.i
# 1 "main.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "main.c"
# 1 "/usr/X11R6/include/my_header.h" 1
# 2 "main.c" 2
int main(){
my_type i;
return 0;
}
[EMAIL PROTECTED]:~/gcc-bug$ cat main.c
#include <my_header.h>
int main(){
my_type i;
return 0;
}


-- 
           Summary: include header file search order issue: broken `-I' and
                    `-isystem' command line options behavior
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nyvsld at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24431

Reply via email to