🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3697

Re: -I vs relative includes

#3697
From: David S. Masterson
Date: Sun, 11 Jul 1993 06:13
39 lines
2885 bytes
>>>>> On 7 Jul 93 22:34:21 GMT, mayer@sono.uucp (Ron Mayer) said:

> In article <21cukd$lbq@truffula.fp.trw.com> awick@truffula.fp.trw.com (Andy
> Wick) writes:

>>What are the pros and cons of -I's vs relative includes?

>>[lots of include files spread over many directories]

>>[What's better:]
>>    [(a) have #include statements contain relative paths to each file]
>>    [(b) use -I option to specify each directory include files may appear]

> I just started using another option; creating a separate project/include
> directory and putting a mechanism in each source directory's makefile to 
> "install" the include files there; and can then access all of them
> with a single -I option.  The advantage is that if I am developing a
> newer version of the software which needs changes to the include files
> I can simply put them somewhere like myhomedirectory/include, and
> access them with a single additional -I option.  The disadvantage is
> that you need to do a "make install_includes" in each directory before
> compilation will work on a new source tree.

You also have to keep an eye on quoted include files while doing development.
A quoted include file is searched for beginning at the directory where the
*current* file is (ie. the file with the #include).  If you make a change to a
master include file in your local directory, then try to do a compile on the
entire system, your changes may not be compiled in as files in the master area
that includes your changed file will pick it up from the master area.

Nasty -- I've begun recommending against using quoted includes...
--
====================================================================
David Masterson					Consilium, Inc.
(415) 691-6311					640 Clyde Ct.
davidm@consilium.com				Mtn. View, CA  94043
====================================================================
"Captain Picard trusts his bartender's instincts and saves the Federation."
-- Karl's synopsis of a recent Star Trek episode
Technical Details
Message-ID: <DAVIDM.93Jul10231312@malibu.consilium.com>
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!news.dfn.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!wupost!cs.utexas.edu!uunet!cimshop!davidm
References: <21cukd$lbq@truffula.fp.trw.com> <MAYER.93Jul7143421@orthanc.sono.uucp>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,cb9385093343e73
X-Google-Attributes: gid11318c,public
X-Google-Thread: fc89c,cb9385093343e73
X-Google-Attributes: gidfc89c,public
X-Google-ArrivalTime: 1993-07-11 14:37:47 PST
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!news.dfn.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!wupost!cs.utexas.edu!uunet!cimshop!davidm
From: davidm@consilium.com (David S. Masterson)
Newsgroups: comp.unix.programmer,gnu.gcc.help
Subject: Re: -I vs relative includes
Message-ID: <DAVIDM.93Jul10231312@malibu.consilium.com>
Date: 11 Jul 93 06:13:12 GMT
References: <21cukd$lbq@truffula.fp.trw.com> <MAYER.93Jul7143421@orthanc.sono.uucp>
Sender: root@cimshop.UUCP
Distribution: comp
Organization: Consilium Inc., Mountain View, California
Lines: 39
In-reply-to: mayer@sono.uucp's message of 7 Jul 93 22:34:21 GMT