porterd@cssexb.csus.edu (darren porter) (01/17/90)
I am trying to write some C programs on a UNIX machine running AT&T V/386 release 3.2.2. My problem is that the cc compiler does not like anything to do with my #include <foo.h> files. Do I need to compile these .h files? I have found nothing in the manuals. Please reply... --- ucdavis!csusac!telco1!dporter
john@stat.tamu.edu (John S. Price) (01/17/90)
In article <1990Jan16.202640.357@csusac.csus.edu> porterd@cssexb.csus.edu (darren porter) writes: > > I am trying to write some C programs on a UNIX machine running AT&T V/386 > release 3.2.2. My problem is that the cc compiler does not like anything > to do with my #include <foo.h> files. Do I need to compile these .h files? > I have found nothing in the manuals. Please reply... > >--- ucdavis!csusac!telco1!dporter If you use #include <foo.h>, cpp will look for this file in /usr/include (it will look for /usr/include/foo.h). If the include files aren't there, you must use #include "/path.../foo.h", or if it is in the directory you are compiling from, use #include "foo.h". This sounds like your problem to me. -------------------------------------------------------------------------- John Price | Morals define our path through life, john@stat.tamu.edu | And everyone's path is different... - Me --------------------------------------------------------------------------
mike@ntmtka.mn.org (Mike Tietel) (01/17/90)
In article <4092@helios.TAMU.EDU>, john@stat.tamu.edu (John S. Price) writes: > If you use #include <foo.h>, cpp will look for this file in > /usr/include (it will look for /usr/include/foo.h). If the include > files aren't there, you must use #include "/path.../foo.h", or if it > is in the directory you are compiling from, use #include "foo.h". > This sounds like your problem to me. > Rather than using #include "/path.../foo.h" use #include "foo.h" with the -I/path... option for cpp. That way if the pathname changes for the header file, you won't need to edit every source file, you'll just need to change one string in the Makefile. -- Mike Tietel Northern Telecom, Inc. (612) 932-8017 9701 Data Park, H-200 mike@ntmtka.mn.org Minnetonka, MN 55343 {rosevax,bungia}!ntmtka!mike
jharkins@sagpd1.UUCP (Jim Harkins) (01/19/90)
In article <4092@helios.TAMU.EDU>, john@stat.tamu.edu (John S. Price) writes: > If the include > files aren't there, you must use #include "/path.../foo.h", or if it > is in the directory you are compiling from, use #include "foo.h". Close, but this ain't horseshoes. If you use #include "foo.h" the compiler looks for foo.h in the directory the source file is in, not neccesarily the directory you are compiling from. For example, if you are in the directory fred and issue the command 'cc ../src/foo.c', foo.h will only be found if it lives ../src, not if it lives in fred. jim "only dead fish go with the flow."
henry@utzoo.uucp (Henry Spencer) (01/20/90)
In article <602@sagpd1.UUCP> jharkins@sagpd1.UUCP (Jim Harkins) writes: >Close, but this ain't horseshoes. If you use #include "foo.h" the compiler >looks for foo.h in the directory the source file is in, not neccesarily >the directory you are compiling from... Actually this is implementation-dependent, although most compilers do it as you describe. -- 1972: Saturn V #15 flight-ready| Henry Spencer at U of Toronto Zoology 1990: birds nesting in engines | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
john@stat.tamu.edu (John S. Price) (01/20/90)
In article <602@sagpd1.UUCP> jharkins@sagpd1.UUCP (Jim Harkins) writes: >In article <4092@helios.TAMU.EDU>, john@stat.tamu.edu (John S. Price) writes: >> If the include >> files aren't there, you must use #include "/path.../foo.h", or if it >> is in the directory you are compiling from, use #include "foo.h". > >Close, but this ain't horseshoes. If you use #include "foo.h" the compiler >looks for foo.h in the directory the source file is in, not neccesarily >the directory you are compiling from. For example, if you are in >the directory >fred and issue the command 'cc ../src/foo.c', foo.h will only be found if >it lives ../src, not if it lives in fred. > >jim >"only dead fish go with the flow." Well, actually, that's what I meant, but now that I read what I wrote, I can see how waht I wrote could be taken wrong. I did mean where the source program was, not where you were compiling from. But, since I almost ALWAYS compile where my source program resides, I made this slight error. Sorry for that mistake... -------------------------------------------------------------------------- John Price | Morals define our path through life, john@stat.tamu.edu | And everyone's path is different... - Me --------------------------------------------------------------------------