Installing Code::Blocks on Windows

Follow these instructions carefully. Do NOT just continue without completely reading each step of the instructions carefully or you will probably not install the software correctly. If in doubt ask a classmate or the instructor to verify what you are doing. If you cannot create a project after installing, then you will need to reinstall following these instructions more carefully.

  1. Download the Code:Blocks binary for your computer from:

    IMPORTANT: download the codeblocks-XX.XXmingw-setup.exe, where X means any number. This is the middle option! The Mingw version includes the gcc/g++ compiler preconfigured and makes our installation easier. If you download one of the other options it will not come with the compiler.

  2. Run Code::Blocks and press the Next button after reading the dialog.

  3. Read the license and press the I Agree button.

  4. Choose the default components as shown and press the Next button.

    For Windows, if you do not see minGW go back to step 1 and download the correct file.

  5. Choose the installation folder shown below and press the Install button.

    Do NOT use the default location or you may have problems later in the installation of SFML or the creation of a project. Instead, install atC:\CodeBlocks to make working at the command line and with SFML easier.

  6. Choose to run Code:Blocks now by pressing the Yes button.

    This step allows us to immediately configure the compiler. You can come back to this step if you decide to run Code::Blocks later.

  7. Select the GNU GCC Compiler as shown, press the Set as default button and then press the OK button.

    If you have previously installed Code::Blocks, you may not see this dialog. If you are changing the compiler, you will need to manually set the compiler path (Settings -> Compiler -> Toolchain executables -> Compiler's installation directory).

  8. Make a choice for the file association and press the OK button.

    Choosing to associate Code:Blcoks with C++ files means that Code::Blocks will start automatically whenever a C++ file is selected, such as by double-clicking an icon on Windows.

  9. Exit Code::Blocks (File -> Quit) and then press the Finish button to exit the installer.

  10. Test the installation by creating a project as shown in the next section.

C. Creating a Project

  1. Start Code::Blocks and click the "Create a new project" link.

    Opening screen

  2. In the New from template dialog select the Empty project template.

    Project type selection

  3. In the "Empty project" start screen press the Next button.

    Empty project wizard starts

  4. Continuing through the Empty project wizard, enter a project title and folder path and then press the Next button.

    Enter project title and folder path

  5. Continuing through the Empty project wizard, verify the GNU GCC compiler is selected and then press the Finish button.

    Verify compiler

  6. In the project workspace, add a new empty file (File -> New -> Empty file).

    Project workspace

  7. If you get the following dialog press the Yes button.

    Add file popup

  8. Save the file using an appropriate file name (hello.cpp) and press the Save button.

    Save file dialog

  9. Confirm the multiple selection and press the OK button.

    Confirm multiple selection dialog

  10. In the file tab (hello.cpp), copy and paste the following program code.
    #include <iostream>
    using namespace std;
    int main()
        cout << "Hello, World!\n";
        return 0;
  11. In the project workspace, build and run the project (Build -> Build and run).

    Project workspace

  12. Verify you get a console window like the following after running the program.

    You should see both Hello, World! and that the process returned 0. Any value other than 0 means there is a problem. If you have problems ask the instructor or a classmate for help. Make sure the console has focus and then press any key to close the console.

    Project console