Getting a C++ Compiler

C++ code can be compiled and run --- usually without any changes --- on any modern operating system, including Windows, Mac OS X, and Linux. Like Python, choice of operating system when programming in C++ usually will not change how your program acts.

However, C++ compilers often come packaged with integrated development environments, or IDEs, that contain a graphical user interface and various tools to help you with programming. These IDEs sometimes are operating system specific; Microsoft Visual Studio, which we use in Barret, is one of those: it only works on Windows.

Below, you can find out how to get your own copy of the Visual Studio environment for Windows, or how to get a similar IDE for Mac. Talk to me if you're using Linux.

Note that just because you've saved a project under Visual Studio in Barret doesn't mean you can't take the .cpp files from within the project and compile them with a different compiler or a different IDE; that works just fine. C++ files (.cpp) are just text files and can be transferred and compiled anywhere. What doesn't transfer are all the other Visual Studio files that are created with a project; those are specific to Visual Studio and are only meaningful under Windows.

Windows

If you use a Windows operating system, you can obtain a free, legal version of Visual Studio 2012 in one of three ways.

Option A: Download the full version of Visual Studio 2012 from Microsoft DreamSpark. This is the best choice because it gives you the exact same environment at home as in Barret, though you have to jump through some hoops first.

Option B: Download the express version of Visual Studio 2013 from Microsoft. This option has fewer hoops to jump through, but the express version of Visual Studio doesn't have all the same features as the full version in Barret. Furthermore, I don't think the project files are compatible between the express and full versions, so if you like to work on the same project in both places, you're going to have a hard time.

Mac

Visual Studio is Windows-only, but the C++ language is not platform specific, so there are plenty of compilers and IDEs for the Mac. One that comes built-in with new Macs (or can be downloaded for free from the App Store) is called Xcode and will compile C++ just fine.

Instructions to make a C++ project in Xcode (version 5) once it is downloaded and installed: