Confusion in command line tools

I know about GCC and G++. GCC is for compiling C programs, and G++ is for compiling C++ programs, both created and are part of GNU. But I have three misunderstandings. 1, I don't know what is the difference between clang-llvm and clang. 2, I have heard about GPP as well, and I am confused about the difference between G++ and GPP, please explain to me like I'm a child. 3, I know a few compilers: the first one is GCC, the second is Clang, and the third is MSVC. Now here is when the confusion kindles, I heard that apple have created their own compiler, and if I wanted to install GCC and G++, I don't know how to install it, if I install command line tools, I am sure it will install Apple's compilers, but the things is that GCC and G++ are not made by Apple.

  • I also want to know if I installed G++ with brew, would it be different than if it is installed by command line tools.

Add a Comment

Replies

  1. Just use clang (or clang++).

  2. I've never heard of "GPP".

  3. Apple have their own version of clang, which differs slightly from the "upstream" clang.

The easiest way to install gcc/g++ is to use Homebrew.

Just FYI, the specific names of the tool you run generally doesn’t matter:

  • The clang command actually points to a compiler driver that does the right thing depending on the extension. So if you pass it a main.c file it’ll compile it as C but if you pass it a main.cpp file it’ll use C++:

    % clang main.c 
    % clang main.cpp
    
  • By default the system includes cc and gcc as alias for clang. So, even though my system just has the Apple tools installed, I can run all of the following:

    % clang main.c
    % gcc main.c
    % cc main.c
    

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"