[英]What is the difference between c++ and g++ on Mac OS X (CommandLineTools)?
I see that c++ and g++ are mostly the same. 我看到c ++和g ++基本相同。 Can they be used interchangably?
它们可以互换使用吗? When they will be different?
他们何时会有所不同?
$ c++ --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ 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.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ which c++
/Library/Developer/CommandLineTools/usr/bin/c++
$ which g++
/Library/Developer/CommandLineTools/usr/bin/g++
On MacOS, c++
is a symbolic link to the clang++
binary. 在MacOS上,
c++
是指向clang++
二进制文件的符号链接。 In your case both c++
and g++
are the same Clang compiler for C++ (ie the LLVM compiler is being masqueraded as the GNU g++ compiler). 在您的情况下,
c++
和g++
是用于C ++的同一Clang编译器(即LLVM编译器被伪装为GNU g ++编译器)。
If you HAD installed the GCC compiler for C++ (more commonly known as g++), the differences between c++ and g++ would have been the differences between clang and gcc compilers. 如果HAD安装了C ++的GCC编译器(通常称为g ++),则c ++和g ++之间的差异将是clang和gcc编译器之间的差异。 For example see this question or this compiler support table .
例如,请参阅此问题或此编译器支持表 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.