Using Multiple GCCs on the same Windows box.

Author: Kagenin
Created: Tue Apr 27 00:24:20 1999

This HowTo is about using Multiple Ports of GCC, the GNU C Compiler, in the same Windows-based PC. The only other way I know of requires rebooting everytime you want to switch. This method only requires you to reboot once, unless you haven't installed a GCC already, in which case you wouldn't have to reboot at all!

For clarification, I'll use these abbriviations: DJGPP\ is your DJGPP
root directory, and EGCS\ Could be your other GCC port's root
directory.  You could be using an Egcs port, Cygwin, Mingw32, whatever.
I'm using Mumit Khan's build of Egcs/Mingw32, so some appropriate
changes if you're using Cygwin, JJ Vanderheijden's build of Mingw32,
Khan's Egcs/Cygwin, AT&T U/WIN,  etc...(yes, there's that many other
GCCs for Win32).

First, remove your compiler's required lines in your Autoexec.bat file.
Path, environment variables, etc...dump them.  You can reboot now, you
can reboot later, but you will have to reboot, unless you don't have a
GCC installed.  All GCC's need a path, so they usually require a reboot
to install and uninstall.  But that's if you keep the info in your
Autoexec.bat file.  I'll explain.

Anyhoo, in your DJGPP\ directory, create a .bat file containing the
following lines:


And whatever else you need to add.  If it went in your autoexec.bat
file, put it here.  Call the batfile djgpp.bat or something.

Next, make a shortcut in that same directory.  Point it to your  Call it "DJGPP Environment" or something like that.  Next,
right-click on the shortcut and click Properties.  Under the Program
Tab, set the Working directory to whatever directory you wish to be in.
In the space after Batch file, put the name of the batfile you just
made.  Under the Memory tab, set Initial environment to as High as it
will go.  Set whatever preferences you want (full screen by default if
you like the feel of the command line, windowed if you need to work
elsewhere if you're not using RHIDE or something).

Now in your Egcs\ Directory, create another batfile.  My port of egcs
had one in there already.  You can use that if you wish, edited for your
configuration, of course.  It should read:

set PATH=Egcs\BIN;%PATH%

Plus whatever else you may need to set for your compiler.  Call it
Ming32.bat, if it isn't called that already.  Now, create another
shortcut, again pointing to your  Do the same stuff you did
for the DJGPP Shortcut, replacing things appropriatly.

Repeat this as many times as you have to for whatever environments you
may also have.  Reboot the system, so the original changes to your
Autoexec.bat take effect.  Go into your DJGPP\ and run the Shortcut we
made.  Go ahead, check the version! (gcc -v for those of you who forgot
^_^).  Close this, and run any other shortcuts you made.  Now check it's
version (gcc -v 'cause it's the same on every GCC).  If all went well,
then you have yourself multiple environments of the worlds greates
compiler.  If not, then check your batfiles' paths, and that the
shortcuts point to the correct batfiles.  If you get an "Out of
Environment Space" error message from dos, then you need to crank up
your inital environment up.

So that's it!  All it requrires is Win95, and the compilers themselves.
If you want.  This can probably work in Win3.x by messing with .Pifs,
but I don't have immidiate access to a Win3.x box with GCC on it.
(Alright, it's cause I hate Win3.x more than Win9x).


  webmaster     delorie software   privacy  
  Copyright © 1999     Updated Apr 1999