Programming C++  «Prev  Next»
Lesson 5 C++ compilers
Objective Course supports differences in C++ compilers.

Differences in C++ Compilers

This course supports the differences in C++ compilers.
The code in this course is written in ANSI C++ and should compile without errors on many ANSI-compliant compilers. ANSI C++, however, is a rapidly evolving standard and many older compilers are not able to use the latest additions in the language. For this reason, the code used in this course was written to run on as wide a variety of compilers as possible. The code has been tested using GNU gcc/g++ (Unix), Microsoft Visual C++ 4.0 (Windows), and Borland C++ 5.0 (Windows). If you are using another compiler, though, you may need to modify the code slightly to get it to compile.
Resolve any compiler-dependent coding problems by hacking the code. You may have to rely on the compiler vendor's support if compiling errors occur.
Key differences might exist in various compiler flags and library files. Keep this in mind when working through this course. Also, check the Compilers Discussion topic for more information on compilers.

How to choose a compiler?

I am often asked to recommend a C++ compiler. I do not make recommendations and I don't know every C++ compiler; there are too many in existence. I recommend that people take standard conformance very seriously when considering a compiler. If you can, avoid any compiler that does not closely approximate the ISO standard or fails to supply a solid implementation of the standard library. The recent releases from all the major C++ vendors do that. Most of these compilers are embedded in frameworks of software development tools and libraries. These frameworks, environments, and libraries can be most helpful, but do remember that their use can lock you into a single vendor and that some uses have significant run-time performance implications.
When looking for C++ on the web, you find that much of the information is "hidden" under various product names. I had more success finding C++ compilers using the search engine than by going directly to vendors that I knew sold them. Here, I have chosen to list C++ implementations simply by the name of their provider, ignoring marketing labels.
Some compilers that can be downloaded for free (do check their conditions/licenses before attempting commercial use):
  1. Apple C++. It also comes with OS X on the developer tools CD.
  2. Bloodshed Dev-C++. A GCC-based (Mingw) IDE.
  3. Clang C++. A relatively new and very active development.
  4. Cygwin (GNU C++)
  5. Digital Mars C++
  6. Mentor Graphics - Lite edition.
  7. MINGW - "Minimalist GNU for Windows". Another GCC version for Windows including a free (non-GPL) w32api.
  8. DJ Delorie's C++ development system for DOS/Windows (GNU C++)
  9. GNU CC source
  10. IBM C++ for IBM power, System Z, Bluegene, and Cell.
  11. Intel C++ for non-commercial development
  12. Microsoft Visual C++ Express edition.
  13. Oracle C++.

Which C++ Compilers are currently the most popular?

  1. GCC: The GNU Compiler Collection (GCC) is an open source compiler that supports several programming languages, including C++, C, Objective-C, and Fortran. GCC is widely used for developing open source software and is the default compiler for many Linux distributions.
  2. Clang: Clang is an open source compiler that is designed to be compatible with GCC, but with better error messages and faster compile times. Clang is used in many software projects, including the LLVM compiler infrastructure.
  3. Microsoft Visual C++: Microsoft Visual C++ is a proprietary compiler that is included in Microsoft Visual Studio, a popular development environment for Windows applications. Visual C++ supports many of the latest features of the C++ language and is widely used by Windows developers.
  4. Intel C++ Compiler: The Intel C++ Compiler is a proprietary compiler that is designed for high-performance computing and supports many advanced optimization features. The Intel C++ Compiler is widely used for developing scientific and engineering applications.
  5. Clangd: Clangd is a newer compiler that is designed to be faster and more lightweight than traditional C++ compilers. Clangd is often used for developing code editors and other tools that require fast code analysis.
There are many C++ compilers available, both open source and proprietary. The most popular C++ compilers in use today include:

C++ How to Program