C:\Program Files\MinGW
, and remove C:\MinGW\bin
and C:\MinGW\MSYS\1.0\bin
from your PATH
.This is an old revision of the document!
For this course, we will be using the Code::Blocks IDE along with the GCC 4.8.1 (or more recent) compiler.
Code::Blocks and the GCC 4.8.1 compiler is known to work well on Windows 7, Windows 9, and Windows 10. Specific notes on installing Code::Blocks on Windows appear below.
Most Linux distributions have a Code::Blocks package. You should use your package manager to install it. However, be aware of the following minimum distribution requirements:
After installing, jump to After installing.
There is a version of Code::Blocks for MacOS, but it is claimed to be very buggy. In addition, I have no idea if it supports C++11 (the version of C++ used in this course). You might be better off with Xcode, but I don't know what is involved in making that C++11 compliant. In short, if you want to use a Mac for this course, you're mostly on your own.
Download codeblocks-13.12mingw-setup-TDM-GCC-481.exe
from the Code::Blocks Download binary page.
Be sure you download codeblocks-13.12mingw-setup-TDM-GCC-481.exe
. Do not download codeblocks-13.12-setup.exe
or codeblocks-13.12mingw-setup.exe
.
The download links are on the right. The last time I tried, the BerliOS link wasn't working, but the Sourceforge.net link worked fine.
After downloading, double click the installer to start the installer. Accept all the defaults and install Code::Blocks.1)
Set the compiler to use C++11 standards. This is very important!
There are several official (as well as unofficial) versions of C++ in common use. We will be learning C++11, which is a relatively new standard. Code::Blocks needs to be told that you want to use this version of C++ rather than an older one.
To do this:
-std=c++11
to the text area and click “OK”.
The project you just created should open. You can see the source code for the project if you expand {name-of-the-project} and “Sources”. (Make sure the “Projects” tab is selected in the left panel.) Double click on main.cpp
to open it in the editor.
You should see some information about the building process in the lower panel, and after a short time you should see a terminal window that says “Hello world!” on the first line and “Press any key to continue” on the last line. Pressing any key will close this window.
C:\Program Files\MinGW
, and remove C:\MinGW\bin
and C:\MinGW\MSYS\1.0\bin
from your PATH
.