---------------------- Forwarded by Amit Kumar Singh/HSS on 05/25/2004 03:39 PM --------------------------- Amit Kumar Singh 05/25/2004 03:30 PM To: Sudeep George <sudeep.george@samsung.com> cc: Subject: RE: Help - header include issues (Document link: Amit Kumar Singh) hi I believe INCLUDE_PATH is incorrect in your makefile , it should be INCLUDE_PATH=-I/usr/src/linux-`uname -r`/drivers/scsi secondly u say that "everything compile okay and hosts.h is found". then u say "on including <scsi.h> and <hosts.h> you get an error", can you explain this please HTH Amit Sudeep George <sudeep.george@samsung.com>@nl.linux.org on 05/25/2004 02:53:15 PM Sent by: kernelnewbies-bounce@nl.linux.org To: kernelnewbies@nl.linux.org cc: Subject: RE: Help - header include issues -----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/ "DISCLAIMER: This message is proprietary to Hughes Software Systems Limited (HSS) and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. HSS accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus." -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/