This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Best environment setup for using gcc?

"Al" <> wrote around 18 Aug 2002
004701c24702$a4dabae0$b2b1869f@oemcomputer">news:004701c24702$a4dabae0$b2b1869f@oemcomputer about %s: 

> Hi. Ive got a rather simple question (which strangly I have had great
> difficulty expressing) about whats considered best practice when it
> comes to setting up gcc.

It's OK, you needed to ask it because you've been laboring under a 

> I installed cygwin the other day. Up to that point I was using a
> version of gcc that came as part of a program called Dev C++ from
> Bloodshed (I think that gcc came from mingw). Anyway, then I had it
> setup so that my PATH included both the path to the bin and include
> directories. Include contained all the common headers including, for
> example, the windows ones so this simple setup worked fine and I
> rarely had to worry about telling the compiler where to locate
> included files. 

You are mistaken in thinking that your PATH setting was helping gcc find
your include headers. PATH is universally used only for finding commands
to execute. It pertains to no other kind of task or file. MinGW GCC was
finding the headers it needed to for other reasons. There are other
settings that are "PATHS" (token-delimited lists of directories or
meta-directories -- of the latter I mean those aware at all of Java
would perhaps say that a JAR file name placed into one's CLASSPATH env
variable is a sort of "meta-directory", for instance). These other
settings -- environmental variables or "macros" to some -- are
program-specific. `CLASSPATH' as just cited would be one example.

In this case the relevant variable is INCLUDE_PATH. By default, the 
INCLUDE_PATH variable is undefined or does not contain any directories. 
Multiple entries must be separated by a colon on Unix-like systems (of 
which Cygwin is one). You can accomplish the same thing on the command line 
used to invoke the C pre-processor and it's debatable whether you even need 
to know about INCLUDE_PATH.

> Now Im not sure what I should set my PATH to so that I will be able to
> launch gcc (the one I got with cygwin) from dos or from other programs
> without worrying about it being able to access the headers. Also I
> dont know if I have to do stuff to make the include files accessible
> when I use gcc from bash. I looked at the output from gcc
> -print-search-dirs but it didnt help me. So how does eveyone else have
> their environments set up? I cant just set my PATH to point to
> usr\include because a lot of the headers are nested in other
> directories like w32api. Is it considered bad to have the kind of
> setup Im talking about and should just be telling it what directories
> to search each time I invoke gcc? Help me conform ... 

You should take special care to remove from your PATH all directory entries 
that might cause a MinGW tool (program / command) to be found where you are 
intending to use Cygwin. Do NOT mix the two.

You should also, I might advise you in a well-meaning way, start to become 
accustomed to the notion that the Cygwin List community isn't a place that 
is uniformly friendly to this kind of posting. Your question is not 
considered Cygwin-specific but rather goes to general (and extremely basic) 
knowledge of shells and of gcc, and the docs at -> gcc would be 
a good place to initiate a long self-administered course of study which you 
need to start to accomplish if you intend to follow the important 
porgrammer axiom of "know thy tools!". That is in addition to the reading 
you have right under your fingertips in the form of `info gcc' (that was a 
command for you to type into your bash session).

   Soren Andersen

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]