簡體   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