Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What is the difference between g++ and gcc?

(g ++和gcc有什么区别?)

Which ones should be used for general c++ development?

(哪些应该用于一般的c ++开发?)

  ask by Brian R. Bondy translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
294 views
Welcome To Ask or Share your Answers For Others

1 Answer

gcc and g++ are compiler-drivers of the GNU Compiler Collection (which was once upon a time just the GNU C Compiler ).

(gccg++是GNU Compiler Collection的编译器驱动程序(曾经只是GNU C编译器 )。)

Even though they automatically determine which backends ( cc1 cc1plus ...) to call depending on the file-type, unless overridden with -x language , they have some differences.

(即使它们根据文件类型自动确定调用哪些后端( cc1 cc1plus ...),除非用-x language覆盖,否则它们会有一些差异。)

The probably most important difference in their defaults is which libraries they link against automatically.

(默认情况下可能最重要的区别是它们自动链接的库。)

According to GCC's online documentation link options and how g++ is invoked , g++ is equivalent to gcc -xc++ -lstdc++ -shared-libgcc (the 1st is a compiler option, the 2nd two are linker options).

(根据GCC的在线文档链接选项以及如何调用 g++g++等同于gcc -xc++ -lstdc++ -shared-libgcc (第一个是编译器选项,第二个是链接器选项)。)

This can be checked by running both with the -v option (it displays the backend toolchain commands being run).

(这可以通过使用-v选项运行来检查(它显示正在运行的后端工具链命令)。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...