How to Install Cygwin Using Babun

<< Back

On This Page



This document provides instructions for setting up a programming environment for use in CS-11. The environment is called Cygwin and is installed using babun (pronounced like "Baboon"). Babun includes not only Cygwin but other addons like an easier-to-use installer and package manager, both of which make installation easier. For a two minute video overview see: Introduction to the Babun Project.

If you are looking for instructions on setting up g++ for Mac OS X, see: How to Install g++ on the Mac

Installation Instructions

  1. Go to the site
  2. Click the Download now button and save the zip file to a easily acessed place like the Desktop or Downloads folder.
  3. Unzip (Extract All) the downloaded zip file.

    For instructions on how to unzip files for Windows see: Zip and unzip files.

  4. Install by double-clicking install.bat (Windows Batch File) inside the unzipped babun folder.
  5. After the terminal window appears, type the following commands and press the Enter key after each command:
    1. pact install gcc-g++
    2. pact install astyle
  6. To verify that your installation was successful, type g++ in the terminal window and press the Enter key. The message "no input files" will appear if you were successful.

    Babun test

    If you were not successful then try the following steps in order:

    1. Restart Babun and again verify by repeating step 6.
    2. Reinstall Babun again starting with step 4.
    3. Reinstall Babun again starting with step 3.
    4. Uninstall Babun by double-clicking the uninstall.bat from the installation folder and then install Babun again starting with step 1.
    5. Email the instructor with a description of the problem including any error messages or a screenshot.
    6. Bring your computer to the instructor, a classmate, or a tutor for hands-on help.
  7. As a final step, set windows to show filename extensions. In addition, you may remove the downloaded zip file and unzipped folder from you computer.

Compiling and Running Programs

In this section we look at how to compile and run C++ programs using your Cygwin installation.

  1. Copy the following program into a text editor like TextPad, Notepad or Notepad++.
    #include <iostream>
    using namespace std;
    int main()
        cout << "Hello, World!\n";
        return 0;
    } // end of main function

    Note that MS Word, or any other word-processing program, is NOT a good choice for a text editor. You can make them work but they are too cumbersome and error prone for working with source code.

  2. Save the above program file in your Cygwin home directory using the file name: hello.cpp

    The Cygwin home directory for Babun is C:\Users\username\.babun\cygwin\home\username where username is the login name for your computer. Make certain that you save the program with the correct file extension of cpp. Windows will automatically add the wrong file extension, unless your text editor is showing the Save as type: "All files (*.*)" in the box under the file name.

    Cygwin finishes

  3. Start Babun by double-clicking the babun icon on the Desktop or selecting babun.bat from the Start menu.

    Babun icon

  4. In the command window, use the ls (el-es, not one-es) command to list all your files. You should see hello.cpp in the terminal window like the following.

    Cygwin ls

    If you do not see the file listed, then you did not save the file in the same folder that Cygwin is viewing. Try again to save the file in the correct folder.

  5. Compile the hello.cpp program by typing the following command at the command prompt and then pressing the Enter key:
    g++ -Wall -Wextra -Wpedantic -o hello hello.cpp
    After running the command, you should see a window like the following:

    Babun compiled

    Verify the file compiled by typing ls (el-es, not one-es) and make sure you can see the hello.exe file.

  6. To run the program type the following and press the Enter key:
    After running the command, you should see the terminal display, "Hello, World!", like the following:

    Babun saying hello

In Case of Trouble

  1. If you try to compile and see a message like, "fatal error: stddef.h: No such file or directory", then update g++ with the following command:
    pact update gcc-core gcc-g++

    After the update, verify you can compile and run.

<< Back

Last Updated: September 06 2017 @00:38:02