2

I ran the following to see what version of g++ I had:

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I thought g++ was a different compiler to clang/LLVM. Can anyone clarify what the above means?

2

In modern versions of macOS, g++ is just a little shim that points to the relevant part of clang in whichever version of Xcode you have installed.

Historically g++ was the C++ compiler that was part of the GCC compiler distribution, but Apple stopped distributing that with the operating system when they moved over to LLVM.

If you want to use the GCC distribution you can install it through homebrew.

2
  • However there is usually no reason to install g++, just use clang. They both meet C++ language standards
    – mmmmmm
    Dec 13 '17 at 0:05
  • Another benefit of clang is that you can use x code debugger.
    – mmmmmm
    Dec 13 '17 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .