Getting Started with C++ (Compilers)
In this post, we will start to build a foundation for developing software applications in C++. Specifically, we will discuss one of the elements in a typical ecosystem for efficiently developing applications using the C++ programming language: compilers.
Here are the most common elements in this ecosystem:
- Build tools and package managers
- Integrated Development Environments (IDEs)
- Debugging and testing
According to Wikipedia, "a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language)." In the context of C++, the compiler is responsible for translating the source code written in C++ into object files.
Here are a few examples of available C++ compilers:
- GCC (GNU Compiler Collection)
- Microsoft Visual C++ (often abbreviated to MSVC)
A natural question that may arise is why do we need more than one C++ compiler? Here are excerpts of a response to this question from Sergey Zubkov on Quora:
One of C++'s distinguishing features is that there is no company or organization behind it. There is no compiler to rule them all. Competition leads to innovation, best innovations are added to the international standard, so the losers have to implement the winners' features or fade into obscurity.
Initially, from 1985 to 1991, there was a reference implementation, Bjarne's compiler CFront, but since the company he worked at decided against turning CFront into a commercial product (mostly -- a few companies got the code to build their own derivations), and since the language was so practical, everyone wanted to be able to compile C++ where CFront wasn't available. Zortech, Oregon, Oasys, Watcom, HP, and others started making their own C++ compilers already in the 1980s.
One reason for the today's variety that I can point out is that every major hardware vendor knows how to use its own hardware best; so IBM, Intel, Oracle, and HP all have their own C++ compilers, which create optimal code on their latest hardware (those are just the ones I'm using - other vendors have more ).
Microsoft has one too, and it's the best choice if you plan to integrate your product with their solutions, and of course Linux and the open source community has GNU g++ since forever and now has the new superstar Clang++ (with some help from Apple and Google).
At Quip Studios, we primarily use the Microsoft Visual C++ compiler, and the easiest way for students, open-source contributors, and individuals to obtain this compiler is to install Microsoft Visual Studio 2019 (Community).