The Penguin Programmer
As mentioned in the Beginner’s Tutorial, after you’ve written the code for your C++ program in your text editor of choice (be it Notepad, Gedit, Textmate, etc.), you must use a compiler to turn it into a form that the computer can understand. There are many different programs for this job, although your choice generally depends on the operating system you are using.
Windows users should download Microsoft Visual Studio—which contains a C++ compiler—or download MinGW, the Windows port of the popular GCC compiler used on Linux. I personally use the Clang compiler, which can be run on both Windows and Linux and works similarly to GCC. I’ve never even touched a Mac so I can’t say much for that area I’m afraid! If you have a package manager installed then you can probably simply use that to install
g++, which is the easiest option.
Using an IDE
As well as a compiler, you’re faced with another choice, which IDE to choose. An Integrated Development Environment is a program which ties together both a compiler and a text editor, and often makes development much easier. There’s no messing around with a shell/command prompt, you can just press a keyboard shortcut and the IDE does everything else for you! Visual Studio is an example of an IDE, but plenty of others exist such as Code::Blocks, which is another good program (and it’s cross-platform too, so will run on most operating systems, not just Windows).
Alternatively you could choose to use only a text editor and instead use a command-line program to compile. In this case, any text editor that doesn’t modify formatting (Word will not do!) is fine, just as Notepad++ or Sublime Text. The choice is up to you, but if you do decide to forgo an integrated compiler then make sure you read the documentation for your compiler of choice so that you can use it proficiently.
For Windows and Linux, the easiest options are probably Visual Studio, and any text editor along with the command line, respectively.
When you first start out you’ll just be making small programs that will easily fit into a single source file, such as
main.cpp. Later on, splitting your program into multiple source files and headers becomes very important. The Beginner’s Tutorial deals with how to do this, but doesn’t cover the when. If you’ve two separate pieces of code that could be split and don’t directly relate to each other, it’s probably a good idea to move them to another file, especially if you plan on using them multiple times. Splitting up one piece of code will commonly force you to split other parts up as well, because the two pieces may use a common piece of code. Eventually you’ll get an eye for how to structure your project, it just takes some experience.