gcc和g++的區別總結:
gcc: GNU C Compiler
g++: GNU C++ Compiler
共同點:
均屬於the GNU Compiler Collection,gcc是鼻祖,后來才有了g++
g++ == gcc -xc++ -lstdc++ -shared-libgcc
(gcc后面兩項都是鏈接選項,表示g++要相比gcc鏈接其他庫函數)
##差異點:
1.g++會自動鏈接C++標准庫,比如algorith,string,vector等。
2.gcc會根據文件后綴(.c,.cpp)自動識別是C文件還是C++文件,g++均認為是C++文件。
3.gcc編譯C文件少很多宏定義,gcc編譯C++會多一些宏定義。
如下:
#define __GXX_WEAK__ 1
#define __cplusplus 1
#define __DEPRECATED 1
#define __GNUG__ 4
#define __EXCEPTIONS 1
#define __private_extern__ extern
原文:https://blog.csdn.net/zhoutaoccu/article/details/86661281
