Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a apple.stackexchange
scroll top