Linux whole operating system
command-line and/or GUI
CygWin native emulator
command-line and/or GUI
Windoze whole operating system
command-line and/or GUI
Linux + g++

Linux is a PC flavor of Unix. It is a 'free' OS and comes with a C++ compiler (g++). You can download it as either individual files or CD images (ISO images) which you can burn onto a CD-R (if you have access to a CD-R or CD-RW drive). You can also buy it at many stores (the bookstore on campus, WalMart, etc.).

In the past, I've recommended Mandrake for its security features and ease of use. [Un]Fortunately...Mandrake has merged with Conectiva. I've not experienced the new product, but it has good roots from which to grow. And there is still a download page (under Individuals¦Products¦...; you'll have to choose which of the desktop variants you prefer. Although I couldn't find any compilers except in the PowerPack variants...*shrug*).

Some might prefer RedHat for its stability, or even Slackware or Debian. Heck, there are thousands of 'em!

Using Linux requires that you either dual-boot your machine (set it up to boot either WinXX or Linux), set up a virtual machine, or dedicate a machine (must be a 386 or greater) to Linux. If any of this scares you or doesn't make sense, just try one of the DOS/WinXX compilering options below.

Linux Resources

Further resources for Linux can be found at:

Compiling on Linux

The C++ compiler on Linux, as I said, is g++. Here, though, is a script that emulates the CPP program you use here on campus. Simply save the file as "CPP" in your login directory. (You can save from your Web browser by holding down while right-clicking the link; one option will be to Save the Link.) Then go to a terminal prompt and execute:

    $ su -c'cp ./CPP /usr/local/bin'
    $ su -c'chmod a+rx /usr/local/bin/CPP'

If you are on an Ubuntu-like system, you'll need to do sudo instead of su -c and you won't need the single quotes. On any system, it will most likely ask you for your password. But on different systems it will ask for the root/admin password or your own user password — pay attention to the prompt!

You'll need to have perl 5.6.0 (or higher) installed. To check on this, execute the following:

    $ perl --version

As long as the version number is greater than or equal to 5.6.0, you're fine.

In addition, it will work best if you have the latest version of the GNU C++ compiler installed. To check this, execute the following:

    $ g++ --version

As long as the version number is greater than or equal to 3.0.1, you're fine.

BTW, to execute your programs, you'll have to do so with:

    $ ./progname.out

The './' is the same standard security measure in Unix systems that you use here on campus.

Handing In a Program from Linux

Feel free to script your programs from Linux, if you like!

If you do, though, please follow the pwd command with this one:

    $ CPP --version

That'll remind me that you are running on your own Linux box and not to expect your warning/error messages to be just like ours on ares. (Your compiler will be newer/better, after all...and this command will even tell me which version you have!)

You'll have to install additionally the show-code program for displaying code inside the script. It also relies on a Python script called pygmentize. This can be installed via the package python-pygments or python3-pygments.

You'll also have to make sure to install aha, pdfjam, xvfb, and wkhtmltopdf as well as this script printing program and this typescript cleaning program to make the standard script instructions work as they do on our campus *nix box.

To install both the script printing program and the typescript cleaning program, use the same instructions as for CPP above but with script-print, show-code, and cleants respectively.


Here are links to free C++ compilers/compiling environments for Windows. I've not used some of these. But, not only do I use both CygWin and Quincy regularly, but I've even heard recommendations for both of them from a respected programmers' journal (Dr. Dobbs Journal). That being said, any of them are still "use at your own risk":


command-line or GUI

CygWin is like having Linux as a desktop application under WinXX. Make sure that when you install you choose the GNU Compiler Collection (gcc and g++ are the most important parts). If you want to use CPP — like here in the lab, make sure Perl was selected for installation (it should be automatic, since much of the system requires perl scripts to run, but it can't hurt to make sure...).

Let me ', there is too much...let me sum up:

If you want to have a nicer/friendlier environment for editing (like the nedit we have here in the lab, for instance), want to play with the graphics mentioned at the end of Chapter 2 (yes, the evil sections), or want to have a nice-like debugging environment, then you can proceed with the next list. Otherwise, just jump down to finish the install.

Once you've selected all the packages you'd like to have available (but don't worry! you can install more and/or update these at any time by simply running the "setup.exe" again), click "Next" and let it install for a while... (You'll also probably need to tell it to include lots of other things on which these main packages depend. There are more and more of these as time goes on. Each package tries to take on more responsibilities and needs more help doing it's a vicious cycle.) It must download all the files, install them to your drive, and then run some 'post-install' chores.

Finally, decide if you want a desktop icon or a startup menu entry and you're ready to go!

The basic setup let's you click that desktop icon or go through the "Start¦All Programs¦Cygwin¦Cygwin Bash Shell" menu location to get a terminal/command prompt. It should look somewhat like the one you have for your Unix account here (on ares) — ending with a nice "$ ", at least. *smile*

Now you can go on to learn how to edit your files within the Cygwin environment.

Editing in Cygwin

If you don't install X (all those files marked xorg...), then you'll just have vi or nano like in a Putty window here. (To use these, you'll have to have installed one of them. If you want nano's cousin pico, you'll have to install the email system "pine" — see how it says "It includes Pico" off to the right?)

If you did install X, then you can use gvim (a more graphically-oriented version of vi; in fact, you can actually go to to get gvim for WinXX if you like...*smile*) or Nedit. Both of these have nice features for programmers — like indenting multiple lines of code that you've just decided to put inside a loop or branch.

You can, though, always use Notepad to edit your program — make sure you put a .cpp or .C extension on it or Notepad always attaches a .txt. Your files for Cygwin are located in C:\cygwin\home\_____\.... The _____ is your WinXX login name and the ... is any subdirectories you've created for your programming projects (& labs).

Compiling and Running in Cygwin

To use the CPP script, you need to save that link as 'CPP' in your CygWin login directory (the one that opens when you open a CygWin window; probably c:\cygwin\home\???? with the ???? filled in with your Windoze account name). Open CygWin and type:

    $ chmod a+x CPP

That will make it executable. Now all you'll have to do to compile your programs is:

    $ ~/CPP hello

Assuming hello.C or hello.cpp is in the directory with you when you do that.

Or, to use an older compiler (version 4, for instance), type this instead:

    $ ~/CPP --compiler=g++4 hello

The '~/' on the CPP above is saying to run the command found in my (well, your, get it, right?) login directory. That way you can run them even if you are storing your programs in subdirectories (i.e. subfolders).

Or, to not have to type that ~/ all the time, you could do this before you compile:

    $ cp CPP /usr/local/bin

Now that you've compiled the program, you can execute it by typing:

    $ ./hello.out

That will run the program. (The './' tells CygWin to run the program that is in the current directory. Recall that this is a standard Unix security measure.)

Scripting in CygWin

If you want to run your scripts in CygWin, you may. Add the following steps to your CygWin setup (or any subsequent update).

Now download the code displaying utility from me. Move it to the /usr/local/bin directory as you did with CPP above. (Make sure to make it executable, too!) For this to work, you'll need a Python script called pygmentize. This can be installed via the package python-pygments or python3-pygments.

Next download the script-print utility, the typescript cleaner, and the corequisite aha program from me. Move these to the /usr/local/bin directory as you did with CPP above. (Make sure you make them executable, too!)

Finally, go to the downloads page for the wkhtmltopdf program and get the Stable version of either win32 or win64 as you need for your system. Run it to install. Now let's set it up to run from wherever you need it.

Let's edit your .bash_profile file. You'll need to use Wordpad unless you installed nedit or vim above. From your Cygwin shell prompt — mine's called Cygwin64 Terminal; you might not have the 64 in there, though — run:

    $ editor .bash_profile

filling in editor with nedit or vim to load it up. Or, if you'd rather, run WordPad from the Run line and load C:\cygwin64\home\Your Name\.bash_profile to edit. (Take out the 64 if you are running the 32-bit version.)

Find the line "# PATH=${HOME}...". Copy it and paste it after the line "#fi". Now take out the pound and two spaces. Take out the "${HOME}/bin:", too — leave the existing quote! Finally put ":/cygdrive/c/Program Files/wkhtmltopdf/bin" after the "${PATH}" part — inside the existing quotes. When you are done, the line should look like this:

    PATH="${PATH}:/cygdrive/c/Program Files/wkhtmltopdf/bin"

Save that and close/restart the Cygwin shell prompt. Now, feel free to script your programs from Cygwin, if you like!

If you do, though, please follow the pwd command with this one:

    $ CPP --version

That'll remind me that you are running on your own Cygwin box and not to expect your warning/error messages to be just like ours on ares. (Your compiler will be newer/better, after all...and this command will even tell me which version you have!)

Getting Help with CygWin

If anything doesn't work, just copy/paste your errors into a [plain text] email and I'll help you 'debug' it.

Copy/Paste for a Cygwin terminal window is in the Edit submenu of the Right-Click menu of the bar across the top of the terminal window — the title bar of the window. Or the Edit submenu found by Left-Clicking the Cygwin icon in the title bar. To copy, you have to Mark with the mouse what you want to copy. Then either go back to the Edit submenu and choose Copy or just hit Enter. Then, you can go to your email program and Paste there as you normally do. (BTW, to Paste in a Cygwin terminal window, you need to go through the Edit submenu and choose Paste. *shrug*)

If you are running X, however, and need to copy/paste from an xterm or rxvt, you can just use the mouse to Mark what you want copied — and it automatically is! (Kinda like in a Putty window...) Then, again, you can Paste in your email program as you normally do. (BTW, to Paste in an xterm or rxvt you can simply Middle-Click, Wheel-Click, or click both Left and Right buttons at once — depending on what type of mouse you have.)

Visual Environments from Microsoft


Downloading Visual Studio (VS) or Visual Studio Code (VS Code or VSC) is relatively easy. I believe I had to make a Microsoft Developer account for free but was otherwise unencumbered. If you have any trouble, please feel free to ask me for help! I just don't remember the entire process right now and am focusing on configuration of the environments once installed today.

Even if you've been using either VS or VS Code for some time now, you'll want to configure your environment for both best practices and smooth workflow with the Harper Unix box.

The main things to configure are the Tabs setup, the end-of-line marker, a final newline on each file, and the file encoding. Of great use, too, is a vertical line or guideline at about 80 characters.

Visual Studio Configuration

The first four items can be configured from a simple file: EditorConfig. You can find out about this file here and about the properties we are interested in changing here. (Note: VS 2022 is having some trouble respecting the EditorConfig file for old file reformatting. It should affect new files, but be careful to not limit it to just your .cpp and .h files!)

Visual Studio Code Configuration

Most of these settings are found and set via Preferences¦Settings from the menu. (This is under Code on a Mac or File on Windoze.) Just use the "search settings" bar to find each item.

As always, if you have any problems, come see me and I'll be glad to help you work it out!

Those Annoying Warnings!

In a future addition, I'll show you how to configure the warnings in these systems to meet the Harper standards rather than being surprised when you get your files uploaded. *smile*

Minimalist Gnu for Windows


MinGW is just a compiler. This is actually a port of the GNU Project's GCC's g++ compiler (for C++) to WinXX. It would be run from a DOS/CMD window. (Kinda like we run our compiler here at school in a terminal window.)



There is another VERY nice front-end (IDE) originally based on the MinGW backend (compiler). It was developed in a series of DDJ articles by Al Stevens. He made several versions since then (Quincy99, Quincy 2000, and Quincy 2002). All are available from Al's Quincy page (of all places!).

After Al left computing to return to his music career (*shrug*), some folks at CodeCutter took over the project.

This new version has seemed pretty stable when students used it in the past. And they've just recently released an update (Feb 2008). The new maintainers have dubbed it Quincy 2005 (although it's getting a little long in the tooth for that...*grin*).

To configure Quincy, make sure to do the following things (all are under Tools¦Options):

You can also find resources for this IDE at:


command-line and GUI?

Watcom (who is an old and well-respected name in the compilers business) has apparently gone open-source! That means free compilers for us...yea!

Bloodshed Software

GUI IDE for g++

Bloodshed Software also has several free compilers — including one for C++. (Don't let the name frighten you. *grin*) (Okay, so it's just a free IDE for the MinGW port of g++. It's still another option!)

My only beef with the Bloodshed folks is that they require you to add special code to a program to 'pause' the display of a console program at its end. Quincy pauses the console display automatically. It would be awesome if the Bloodshed folks would look through some old DDJ issues for the Quincy development articles or at the Quincy source (which is on the site or the Quincy CD) to see how that worked... (*nudge* *wink* Of course, I'm sure they'd check with Mr. Stevens to make sure it was okay to borrow it first...*grin* (I think it is allowed in the license, actually, but it's been a while since I read it...*shrug*)


The command-line tool DJGPP works with the pseudo-GUI front-end RHide. (This is actually a DOS port of the g++ compiler, but will work in a DOS window. Note that RHide is also available for Linux — and Cygwin? — as an IDE for the real g++.)

Many, many others!

There are many alternatives to these environments, most are based around the GNU g++ compiler or its MinGW variant (although there are other free compilers — avoid 'interpreters'!). Here is a site with a convenient list of IDEs and/or editors that are programmer-oriented. (Thanks TheFreeCountry!)