繁体   English   中英

在Mac OS X(CommandLineTools)上,c ++和g ++有什么区别?

[英]What is the difference between c++ and g++ on Mac OS X (CommandLineTools)?

我看到c ++和g ++基本相同。 它们可以互换使用吗? 他们何时会有所不同?

$ 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++

在MacOS上, c++是指向clang++二进制文件的符号链接。 在您的情况下, c++g++是用于C ++的同一Clang编译器(即LLVM编译器被伪装为GNU g ++编译器)。

如果HAD安装了C ++的GCC编译器(通常称为g ++),则c ++和g ++之间的差异将是clang和gcc编译器之间的差异。 例如,请参阅此问题此编译器支持表

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM