Subject: RE: gcc problem
From: [email-masked] (Steven J. Zeil)

21 Oct 1997 08:04:24 -0700
Message-ID: <[email-masked]>
References: <01BCDDFA.464DD640@gbird0>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: "'GNU-Win32'" <[email-masked]>
Cc: "[email-masked]'" <[email-masked]>

On Tue, 21 Oct 1997, Colin Peters wrote:

> Frank Packenham[SMTP:[email-masked]] wrote:
> >Well the install seemed to go well, but when I try to compile ( or make )
> >anything this is the result.
> >
> >bash$ gcc laws.c
> >Borland C++ Preprocessor Version 4.00 Copyright (c) 1993 Borland
>  ^^^^^^^
> >International
> >Error: Incorrect command line option: -undef
> >gcc: Internal compiler error: program cpp got fatal signal 1
> >
> 
> The problem, mainly, is that gcc is expecting to call the GNU version of
> cpp, and it's getting the Borland version (you have a Borland compiler
> installed, correct?). Cpp is the preprocessor, and it gets passed many
> options you give on the gcc command line, as well as lots of options
> internal to the two. Obviously Borland's cpp, while a program with the
> same purpose, doesn't have the same command line syntax, and nothing
> works.
> 
> Solutions include:
> 
>  - Setting up your environment so GNU cpp is earlier on the path and/or
>    Borland's is not. You might do this with a pair of batch files or
>    shell scripts for switching between "environments" (I like to set
>    up icons which run the correct batch file and start a dos shell in
>    such circumstances).
> 

This will, however, prevent Borland's compiler from working, as it will
then try to access the GNU cpp instead of its own.

I've run into many similar clashes between $PATH and other environment
variables.  The solution I have evolved is this:

In autoexec.bat, set up a baseline path that does not include ANY of the
conflicting programs' binary directories:

  PATH c:\bin;c:\windows;...and so on...
  SET BASEPATH=%PATH%

Then set up a series of utility batch files to augment the path with the
binary directories for a given program.  For example, I have usegcc.bat:

  @PATH h:\gnuwin32\b18\H-i386-cygwin32\bin;h:\gnuwin32\b18\tcl\bin;%BASEPATH%
  ... may wish to set other gcc environment variables here instead of in
      autoexec.bat ...

and I have usebcc.bat:

  @PATH h:\bcwin32\bin;%BASEPATH%

and a similar script for Visual C++.

Then I can simply type
  usegcc
or 
  usebcc
at an MSDOS prompt before starting to work with any compiler.

For enthusiasts of double-click program launching, create a batch file
like
   usebcc
   bcw
and bind that, rather than the bcw program itself, to the Borland .ide 
file type.

Steve Zeil

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".