Search

List of Top 10 C/C++ Compilers

Those who are up to date!


List of Top 10 C/C++ Compilers


Creating a C/C++ Compiler is a very difficult thing to write and takes years, in many cases: decades. And besides, it’s trying to compete with those who dominate the market and will be almost impossible to replace.

The C language had its first compiler(cc C Compiler) made by its own creator: Dennis Ritchie. So was C++, its first compiler(Cfront) was written by its creator: Bjarne Stroustrup.

People always like alternative tools for n reasons.

So, in this article we will see a list of 10 compilers for C and C++ and they are separated numerically according to their efficiency and update as follows:

  • 1. from number 01 to 03 - The 3 best and most updated on the market;
  • 2. between the numbers 04 to 07 - the alternative compilers that may one day make the best list;
  • 3. the numbers: 08 and 09 - recent projects with great potential;
  • 4. and finally the number 10 - for the sake of honor! 😃

Let’s go to the list!


01. GNU Compiler Collection gcc/g++

GCC

This one certainly had and should always be the first in any list of C/C++ compilers. Well, it supports the largest number of architectures, the oldest among the best and served as a basis/inspiration (in some cases even fork) for several others, including the other two best.

It is a complete compiler and optimizer produced by the GNU Project that supports various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License (GNU GPL).

With around 15 million lines of code in 2019, GCC is one of the biggest free software out there.

When it was first released in 1987 by Richard Stallman, the GCC 1.0 was named the GNU C Compiler as it only dealt with the C programming language. It was extended to compile C++ in December of that year. Today it has a list of several other programming languages

Usage examples:

Compile C++ code, eg main.cpp

g++ main.cpp

Compile C code, eg main.c

gcc main.c

02. Clang/LLVM clang/clang++

Clang

This compiler is, for sure, GCC’s biggest competitor, and may even (who knows one day) surpass it!

It was initially developed by Chris Lattner(perhaps, currently the guy who most understands compilers/interpreters in the world) and later by a team, which includes names, which Chris Lattner himself says that: if it wasn’t for them, Clang/LLVM wouldn’t be so good.

Chris Lattner has stated several times that he was interviewed that his biggest source of inspiration was the GCC.

Clang is nothing more than a front-end for LLVM.

LLVM is the one who actually transforms the code! It is written in C++ and took about two decades to get ready, and that was only possible because Apple was the company responsible for financially supporting the LLVM programmers during all this time, but also had support from companies: Google, Microsoft, ARM, Sony, Intel, and AMD.

LLVM is also used by languages: Zig, Swift, Rust, Codon and among several others. Therefore, these new languages are, in fact, front-end to C++/LLVM, which is one of the reasons they have appeared in so many numbers in recent years!

In addition to C/C++, Clang/LLVM also compiles the codes of languages: Objective-C, Objective-C++, OpenMP, OpenCL, RenderScript and CUDA.

Usage examples:

Compile C++ code, eg main.cpp

clang++ main.cpp

Compile C code, eg main.c

clang main.c

03. Microsoft Visual C++ msvc/cl

MSVC

MSVC was originally a standalone product, but later became part of Visual Studio. It has tools for developing and debugging C and C++ code.

Usage examples:

Compile C++ code, eg main.cpp

cl main.cpp

Compile C code, eg main.c

cl main.c

04. Intel C++ Compiler icpx/icx

icx

This compiler is part of the Intel OneAPI HPC Toolkit which are Intel C, C++ ,SYCL and Data Parallel C++ (DPC++) compilers for Intel processor-based systems, available for Windows, GNU/Linux and macOS

Usage examples:

Compile C++ code on Linux, eg main.cpp

icpx main.cpp

Compile C++ code on Windows, eg main.cpp

icx main.cpp

05. IBM XL C/C++ Compilers ibm-clang/ibm-clang++

IBM XL C/C++

XL C/C++ is the name of the IBM compilers for C/C++.

These are front-ends, including a top-notch optimizer. Although independent of hardware architectures, they are intended for: POWER, BlueGene/Q and IBM Z.

Usage examples:

Compile C++ code, eg main.cpp

ibm-clang++ main.cpp

Compile C code, eg main.c

ibm-clang main.c

06. Oracle C++ Compiler CC

Oracle

The Oracle C++ compiler consists of a front end, optimizer, code generator, assembler, model prelinker, and link editor. The CC command invokes each of these components automatically, unless you use command line options to specify otherwise.

Usage examples:

Compile C++ code, eg main.cpp

CC main.cpp

Compile C code, eg main.c

CC main.c

07. EDG C++ Front End eccp

EDG

It is an iC/C++ front-end compiler developed by the company: Edison Design Group.

Supports ISO/IEC 14882 standard. C++17, C++14, C++11 and C++98/03 language versions are fully supported. Work is ongoing to support the C++20 language features.

Usage examples:

Compile C++ code, eg main.cpp

eccp -c main.cpp

Compile C code, eg main.c

eccp -c main.c

08. Circle circle

Circle

Circle is a new, different compiler and includes its own language, a:Circle.

It focuses on a new versioning mechanism that allows the compiler to fix defects and make C++ more secure and productive while maintaining 100% compatibility with existing code.

Although the project already has versions available for use, it is still under development.

Internet address: https://www.circle-lang.org/

As of the date of publication of this article, only version available for GNU/Linux distributions and the most recent one is Build 198.

It can be installed as follows:

mkdir bin-circle
cd bin-circle
wget https://www.circle-lang.org/linux/build_198.tgz
tar zxvf circle_build_198.tgz
sudo install -v circle /usr/local/bin/

Testing Circle:

cat << EOF >> main.cpp
> #include <iostream>
>
> int main(){
> std::cout << "Hello Circle\n";
> }
> EOF

As Circle does not have a defined path for STL, you will have to use the standard library of another compiler to avoid the error: cannot find header iostream. In this case, for example, if you have GCC 11 installed, the path to compile would be:

circle -nostdinc \
       -I/usr/include/c++/11 \
       -I/usr/include/x86_64-linux-gnu/c++/11 \
       -I/usr/lib/gcc/x86_64-linux-gnu/11/include \
       main.cpp

For more information see here.


09. C++Builder

C++Builder

In addition to a compiler and optimizer, C++ Builder is also a rapid application development environment (RAD) for developing software in the C++ programming language.

Originally developed by Borland, as of 2009 it is owned by Embarcadero Technologies, a subsidiary of Idera. C++ Builder can build apps for Windows (both IA-32 and x64 ), iOS, macOS and Android (32-bit only).

Its internet address and how to install: https://www.embarcadero.com/products/cbuilder

To use C++ Builder through CMD/PowerShell/Windows Terminal you can add the address: C:\Program Files(x86)\Embarcadero\Studio\[VERSION]\bin to the Windows Environment Variable(PATH).

And run via command line according to this article.

Example:

bcc32 main.cpp
main.exe

As the image below: PATH to C++ Builder

Credits by Yılmaz Yörü.


10. Comeau C/C++

Cfront

Remember that at the beginning of the article I talked about a matter of honor? Yes, Comeau C/C++ is the new name of the first C++ compiler: Cfront.

In 2006-2008 it was described as the only mainstream C++ compiler to fully support the export keyword.

This compiler is owned by the company Comeau Computing which is a founding member of the C++ committee!

Nowadays, this compiler is deprecated, but you can get more information here.


I hope you enjoyed the list and until next time!


cpp clanguage gcc llvm cppdaily


Share



Comments