Compiling with MingGW


When your program is running correctly, you'll need to use ftp software to move it to csc.oakton.edu and then use telnet software to submit it.  These notes are from a MS Windows XP machine running MinGW Release 2.0.


Downloading and Installing MinGW


The recommended method of installation for beginners involves downloading the latest version of the single-file distribution, rather than any individual packages.

After downloading the archive, create a directory on your system that you wish to serve as the base of the installation (i.e. C:\MINGW). Extract the distribution archive into this directory. If your compression/extraction application does not by default preserve the directory structure of archive contents, be sure that you instruct it to do so manually.

The last step is to add the \bin subdirectory of MinGW installation to your PATH (the procedure for doing this varies based on the operating system version you are using).  In old MS operating systems, you can simply edit your autoexec.bat file with an ASCII editor.  In MS XP, I had to find the Control Panel and then the System icon.


In that form, click on the Advanced and then the Environment Variable buttons.
 


Click on the PATH variable and then the Edit button and insert the following into the PATH list, C:\MINGW\bin;Click on all of the OK buttons until you are again at the Control Panel.
 


To verify that installation completed properly, open an MS DOS window and issue the command gcc -v. You should see output close to the following:

            Reading specs from c:/mingw/bin/../lib/gcc-lib/mingw32/2.95.3-5/specs

You can open an MS DOS window by typing cmd into the window of the Run command.


From the MS Start icon, move to the Programs and then the Accessories and then to Notepad (other ASCII editors can be used).
 


Type your source file into the editor.
 


Save the program into a file, let's call it hello.cpp and open a DOS window.  This can by done by typing cmd into the window of the Run command.  You may need to use the cd command to make sure that the DOS window is in the same directory as the source file.
 
 


Compile the program by typing the the command g++ -o hello hello.cpp into the DOS window  Correct any syntax errors before proceeding.
 


Execute the program by typing the command hello into the DOS window.