Installing a C++ Compiler

Read time: 9 minutes (2484 words)

Many (but not all) IDE systems come with all the tools you need. We are not using an IDE, so we need to install those tools ourselves. Since we are going to use C++ at the command line for much of our work, we need a good C++ compiler. One of the best available is the Gnu C/C++ tool set. This is found on all Linux machines, and can be installed on Mac and WIndoes if needed.


I have about four different C/C++ compilers available on my systems. It is a good idea to test your code on various compilers, to make sure it is in the best possible shape before you turn it loose on other humans!

Windows Setup

There is a great version of this compiler available from the Mingw-w64 project:

If you have a 64-bit Windows PC (you probably do if it is running Windows 10, or is fairly new), use this link:

For other (or older) systems, see me, or look around on the project page. There are installers for just about anything.

Installing the program is fairly easy, but you need to watch one point in the process.


When you get to the window that asks you to install the code, there is a window with several options showing. The default entry labeled “i686” is correct for 32-bit machines, but needs to be changed to “x64” for a 64-bit system.

Mac Setup

If you do much development work on a Mac, you are going to need to install XCode. This package is free, but you do need to have a good network connection. Last time I installed it, it was a 5GB download that took a while. You get it from the Apple “App Store”.

Once that package is downloaded and installed, open it up to complete the initial setup. Then navigate to the following link:

  • Xcode -> Open Developers Tool -> More Developers Tools

You will be asked to sing up as a developer, and provide your Apple ID to do this. It is all free, o fill out the forms and get se tup.

Then select “Command Line Tools” and add them to your system. Once all of this has been done, ou should be ready to code

To verify that you are set, we need to open up a “command prompt” window on your system.

Accessing the Command Line

We are going to run commands the old-fashioned way, by typing them in. To do that, we need a command line window. Here is how you get to this interface:


Use the search tool and type “CMD”. Select “Command Prompt”


Open up the “” program (found under Applications->Utilities)

$ g++ --version
Configured with: --prefix=/Applications/ --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/

This is what I see on my current development Macbook Pro. On a PC, you will see something different. As long as you get something similar as a response, you are ready to code!