Warning: This page is being maintained mainly for my students. Use these instructions at your own risk. There is no warranty in any form or shape whatsoever!. There is no guaranty that these instructions are up-to-date. With that understanding, you may continue with the rest of this page if you choose to accept these terms.
This page was last updated on September 13, 2005.
Follow these steps to install g++ (the GNU C++ compiler) for Windows. There is no room for creativity here; you must follow the directions exactly.
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
You now should add it to the PATH environment variable. You
do that by following:
Start -> Control Panel -> System -> Advanced -> Environment VariablesAt this point you can see the PATH variable either in the User Variables or in the System Variables. Add the g++ path into the PATH variable. You add it to the end of the existing value separated by a semicolon (';'). Make sure that you do not lose the original value. You are just appending more to the end separated by a semicolon.
You should now be able to run g++ from a DOS (Command Prompt) window. For example, to compile a file called C:\mine\hello.cpp, connect to the C:\mine folder and enter
g++ -g hello.cpp -o hello -lm
You'll then be able to run the compiled program by entering
hello in the DOS window.
If you've installed Emacs as described here, you will also be able to run g++ from Emacs. If, when you do this, Emacs tries to compile with the command make -k, you made a mistake during the Emacs installation. If you want to learn how to run g++ on emacs, see here.
If you'd like to learn more about where this free compiler came from, we downloaded it from an older site of http://sourceware.org/cygwin/.
If you wish to clean up a little, you may delete the file: full.exe at this point. Your g++ compiler is installed under C:\cygnus.