MinGW (gcc) and jGrasp Installation Instructions

The jGrasp environment is installed and properly configured for your use in the Computer Science department labs. Even so, many students opt to setup a similar environment on their home computers. This guide is meant to assist you in so doing.

jGrasp is actually an integrated development environment that wraps the gnu compiler collection (gcc). jGrasp is not itself a compiler. As such, the first step is to install gcc. These instructions are intended for Windows users.

If you are using Linux, then you should already have gcc installed and can just install jGrasp. If you are using MacOS X, then you can install gcc by installing the XCode package from your installation CD. Once done, download jGrasp from jGrasp download page and install it. Note that jGrasp uses the Java runtime environment (JRE). If you already have the JRE installed (e.g., if you can view Java applets in your browser), then you can click the first button, jGRASP.exe. If not, click the second button, jGRASP JRE.exe. If in doubt, click the second button (though it is a significantly larger download).

Windows users should continue to the next step. There are some other options for installing gcc, but this is one of the simpler options.

MinGW

Download

First, download the following package (zip file), saving it in some easily accessible location. These package contains the MinGW gcc compiler installation including additional utilities and necessary libraries.

gcc.zip

Extract

Next you will need to extract the contents of the package. You should be able to open this under Windows XP. If there are any problems, you can download one of a number of utilities (such as WinZip) that can open the package. You may extract the contents to any directory (folder) that you'd like. The package contains a directory named gcc that, in turn, contains a number of other directories. I chose to place this in the "C:\Program Files" directory. The screenshot below shows the contents of "C:\Program Files\gcc" after extracting the files from the package. Once you have completed this step, you should have the same set of subdirectories shown below.

Installation Directory

Setting the Path

To simplify the use of gcc and to allow jGrasp to find this compiler, it is advisable that you modify the Path environment variable for Windows. To do this, right-click on the My Computer icon and select Properties or, from the Start menu, open the Control Panel and select System. Once opened, click the Advanced tab, and depress the Environment Variables button (see the highlighted image below). Scroll down to the Path variable and click Edit. At the end of the text field add ;C:\Program Files\gcc\bin (if you extracted the files to a different location, then you will use that location instead). Caution: Do not delete the path that is currently set. Just add to the end of it.

There are two things to note here. First, each portion of the path variable is separated by a semicolon (;). This is required, so if you run into problems, carefully check your addition to the path. Second, you want to include the bin (meaning binary) directory (folder) as part of the path (note the end of the path in the image). This directory contains the executables (the applications or programs in Windows terminology) for the compiler and its associated utilities. After you modify the path, be sure to click the Ok button for each dialog window.

Modifying the Path

Quick gcc Sanity Check

As a quick sanity check, open a command shell by selecting Run from the Start menu and executing cmd.

Starting the cmd Shell

In the command window, type gcc. If your path is set correctly, you will see a response from the compiler such as that shown below.

Testing gcc

jGrasp

With gcc installed, the next step is quite straightforward. Download jGrasp (select the jGRASP JRE exe button for the Windows self-extracting exe with JRE 1.5) and install it (follow the installation prompts from the executable). Next, try compiling and running the example illustrated in the following image. After typing the source code, you can compile and link the program by clicking on the icon that has two plus symbols (highlighted below). If it builds correctly (which it should as long as you have correctly installed the compiler), then you can execute the program by clicking the running stick figure icon.

Testing jGrasp

At this point, you should be set. Try the examples from the first lab or some examples from the textbook.

Make Utility

Make is a utility to aid in the compilation of large projects. Its use is also important in the context of jGrasp when working with multiple files. The following directions should help you to install make on your personal machine.

  1. Download the make installer: mingw32-make-3.80.0-3.exe
  2. Run the installer and install make into the same directory in which you installed gcc.
  3. Find mingw32-make.exe and change its name to make.exe. This will allow jGrasp to find make.