As mentioned in the previous section, an Integrated Development Environment (IDE) contains all of the things you need to develop, compile, link, and debug your programs. So let’s install one.
The obvious question is, “which one?”. Keep in mind that you can install multiple IDEs, so there is no “wrong decision” here. During the course of these tutorials, we will be showing you some of the nice features of your IDE, such as how to do integrated debugging. All of our examples will be done using both Microsoft’s Visual C++ (for Windows), and Code::Blocks (for Linux or Windows). Thus we highly recommend you pick one of these.
However, if you would like to try a different IDE, you are free to do so. The concepts we show you will work for any IDE -- however, different IDE’s use different keymappings and different setups, and you may have to do a bit of searching to find the equivalent of what we show you.
If you are developing on a Windows machine (as most of you are), then you have two choices:
1) If disk space and/or download size are not a constraint, then we recommend Visual Studio Community 2015. Note that Visual Studio 2015 does not come with the C++ compiler installed by default, so you’ll need to do a Custom installation and choose “Programming Languages -> Visual C++”. You can also uncheck the “Windows and Web Development” checkbox if you want to save some room, as you won’t need those for this tutorial series.
2) If disk space and/or download size are a challenge, then we recommend Microsoft’s free Visual Studio Express 2013 for Windows Desktop. When asked, choose “wdexpress_full.exe” and run it.
The installer that you download off of Microsoft’s web page is actually a downloader. When you run it, it will download the actual IDE from Microsoft and install it.
Note: This tutorial was originally written when Microsoft was distributing the 2005 version of Visual C++. Consequently, most references and screenshots are targeted to that version. Running any later versions (such as 2008, 2010, 2013, 2015, etc…) are fine, however, your screens may look slightly different.
Linux or Windows IDEs
If you are developing on Linux (or you are developing on Windows but want to write programs that you can easily port to Linux), we recommend Code::Blocks. Code::Blocks is a free, open source, cross-platform IDE that will run on both Linux and Windows.
Windows users: make sure to get the version with MinGW bundled.
With Code::Blocks, C++11/C++14 functionality may be disabled by default. You’ll definitely want to check and turn it on. First, go to Settings->Compiler:
Then check the box marked “Have g++ follow the C++11 ISO C++ language standard [-std=c++11]:
Note: If “Have g++ follow the C++14 ISO C++ language standard [-std=c++14]” exists for your version of Code::Blocks, use that instead.
Alternately, some people prefer to use Bloodshed’s Dev-C++, which also runs on both Windows and Linux.
Mac OSX IDEs
Can I use a web-based compiler?
Yes, for some things. While your IDE is downloading (or if you’re not sure you want to commit to installing one yet), you can continue this tutorial using a web-based compiler, such as the one at CodeChef. Make sure you switch the compiler to “C++14 (G++ 4.9.2)”.
Web-based compilers are fine for dabbling and simple exercises. However, they are generally quite limited in functionality -- many won’t allow you to save projects, create executables, or effectively debug your programs. You’ll want to migrate to a full IDE when you can.
Once your IDE is installed (which is one of the hardest things this tutorial will ask you to do), or if you’re temporarily proceeding with a web-based compiler, you are ready to write your first program!
|0.6 -- Compiling your first program|
|0.4 -- Introduction to development|