-----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Davidlohr Bueso A Sent: Tuesday, May 25, 2004 1:32 PM To: c.lucas@ifrance.com; whereisit28@yahoo.com Cc: kernelnewbies@nl.linux.org Subject: Re: Help - header include issues On Sat, 2004-05-22 at 03:41, Christophe Lucas wrote: > l x (whereisit28@yahoo.com) wrote: > > Hi, > > > > I found a very stange problem related to header file > > includ. Could some one take a look and see what > > causes the problem? > > > > One C source file needs to include 2 system header > > files scsi.h and hosts.h. They both are under > > /usr/src/linux-2.4.18-14/drivers/scsi/ and hosts.h > > uses structures defined in scsi.h. > > > > To avoid using hard-coded path when including them in > > the c file, the following two lines are added to the > > Makefile: > > > > INCLUDE_PATH = -I$//usr/src/linux-`uname > > -r`/drivers/scsi > > [...] > > Everything is compiled okay. This means the path > > included in the Makefile works okay because it can > > find hosts.h. > > > > (2) If I include them like this: > > > > #include <scsi.h> > > #include <hosts.h> > > > > Compile errors show structures used by hosts.h can not > > be found, meaning scsi.h can not be found. > > > > This is strange. Why only one header file can be > > found but not the other while both of them are in the > > same directory? What can be wrong? > > I think you must include them by : > #include "scsi.h" > #include "hosts.h" > > Perhaps I make a mistake, If it is true, please correct me :-) > > #include "my_header.h" == #include <my_header.h> > The " " and < > are just coding conventions. There is a difference between using #include <> and #include "" Pasting the relevant section from the "The C Preprocessor" manual: ------------------------------------------------------------------------ ---- "GCC looks in several different places for headers. On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with #include <file> in: /usr/local/include /usr/lib/gcc-lib/target/version/include /usr/target/include /usr/include You can add to this list with the '-Idir' command line option. All the directories named by '-I' are searched, in left-to-right order, before the default directories. GCC looks for headers requested with #include "file" first in the directory containing the current file, then in the same places it would have looked for a header requested with angle brackets." ------------------------------------------------------------------------ -- Hope this helps w.r.t to the problem in picking up the <scsi.h> file > Have a good day :) You too Dave -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/