EECS 211
Cygwin Notes

This course uses the gcc compiler and, to a lesser extent, the Unix or Linux environment, both for consistency, and to expose you to the platform used by many practitioners in computer science. Unix / Linux and gcc are available automatically on Linux and MacOS X machines, and Windows, using Cygwin. This page is about setting up Cygwin for Windows.

Cygwin is a Linux-like environment for Windows. It can be downloaded for free from http://www.cygwin.com. This is the environment that will be used to demonstrate things in class.

System requirements

You need Windows XP or Vista. Like MacPorts, Cygwin comes with an installer that lets you get just the tools you need. For this course, you only need the Gnu C++ compiler and some standard tools, like CppUnit, which requires about 150 megabytes.

Installing Cygwin

Cygwin is fairly simple to install. You first download a small installer program. Then you run this installer to download the Cygwin packages you need. The installer takes care of downloading and installing not only the files you ask for, but any files those files require.

The instructions below should get you going. If you'd like more information, see the Cygwin setup notes.

When the installer asks how you want to get the Cygwin files, select the first option. This will download the files you pick and then install them automatically.

Click Next.

Cygwin download source dialog

When the installer asks where you want to put the Cygwin files on your machine, you can use the default c:\cygwin, or any other place where you have a reasonable amount of space.

You can also specify whether text files should be generated using DOS (Windows) or Unix line terminators. If you're going to use a Cygwin editor like vi or emacs (recommended, since we will be using the emacs editor in lab sessions), leave this as Unix. If you're going to use some Windows editor, select DOS instead.

VISTA USERS: Check the Just Me option, not All Users.

Click Next.

Cygwin download directory dialog

When the installer asks where you want to put Cygwin's temporary files, you can use the default, which will be a directory in your user document and settings directory. These files can be deleted later if you need the space.

Click Next.

Cygwin download temporary directory dialog

When the installer asks what kind of connection you want, just use the default first option.

Click Next.

Cygwin download connection dialog

When the installer asks which site to download from, pick a location near you. I chose Argonne National Laboratory.

Click Next.

Cygwin download site dialog

Now the installer asks which packages to download. This dialog box is like a Windows Explorer directory tree.

The tools you must have are under Devel, which stands for "Development." If you want to download a unix editor (recommended), it is under Editors.

To see things better, first enlarge the dialog box to full screen.

Cygwin download packages dialog

Click on the plus (+) sign to the left of Devel to view the development packages. Each package has a small icon with arrows in a circle. The default status is Skip, i.e., don't download. To select a package to download, click on the icon once. This selects the current stable release of that package.

Warning: Click just once to select a package. If you click again, you'll cycle through other options. This can cause other subpackages to be automatically selected. The installer does not unselect subpackage when you change the selection. Hence if you click multiple times you may end up downloading unnecessary, even inconsistent, packages. If you select the wrong thing by accident, I recommend cancelling and starting over.

Cygwin select packages dialog

Packages are stored under categories. Here are the ones you need for this course and what category they appear under:

CategoryPackageWhat is it
Archivezip and unzipPrograms to compress and decompress files and directories
Develcppunita package for writing C++ test code
Develg++the Gnu C++ compiler
Develgdbthe Gnu C++ debugger
Develmakea standard Unix tool for managing applications with multiple files
Editors(optional) emacs, xemacs, or vim if you don't want to use Code::Blocks

Click Next.


The Cygwin installer will now download the requested packages and install them. When it's done, it will ask you if you want to create a desktop icon for the Cygwin command shell, and an entry in the Windows Start menu. I recommend that you at least take the desktop icon.

Cygwin finish dialog

To start the Cygwin shell, just double-click the desktop icon. This will open a command window, similar to Microsoft's DOS shell, but instead of DOS commands, you have Unix, including the Gnu C++ compiler.

Cygwin shell window

Creating a home directory

Unix, and therefore Cygwin, starts you off in your "home" directory when you open the shell window. Cygwin by default will create a home directory for you inside the Cygwin directory, which can be a problem if you need to reinstall Cygwin later. Therefore, it's better to define a home directory in a safer place, such as your EECS 211 projects directory.

You do this by defining a Windows environment variable called HOME.

Right-click on your My Computer icon and select Properties from the menu. The System Properties dialog box will appear. Click on the Advanced tab.

Windows Systems Properties dialog

Click on Environment Variables.

Windows Systems Properties dialog

Click New under User variables.

Windows Systems Properties dialog

Type HOME into the Variable name field and whatever directory you are using for EECS 211 code into the Variable value field.

Click OK to save your changes.

Now when you open a Cygwin window, it will put you in the directory you specified in HOME.

Windows Systems Properties dialog

Comments? comment icon Contact the Prof!

Valid HTML 4.01 Transitional