gcc/g++区别

原文:https://www.geeksforgeeks.org/difference-between-gcc-and-g/

GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The most important option required while compiling a source code file is the name of the source program, rest every argument is optional like a warning, debugging, linking libraries, object file, etc. The different options of GCC command allow the user to stop the compilation process at different stages.

g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file. The different “options” of g++ command allow us to stop this process at the intermediate stage.

DIFFERENCE BETWEEN g++ & gcc

g++gcc
g++ is used to compile C++ program.gcc is used to compile C program.
g++ can compile any .c or .cpp files but they will be treated as C++ files only.gcc can compile any .c or .cpp files but they will be treated as C and C++ respectively.
Command to compile C++ program through g++ is
g++ fileName.cpp -o binary
command to compile C program through gcc is
gcc fileName.c -o binary
Using g++ to link the object files, files automatically links in the std C++ libraries.gcc does not do this.
g++ compiles with more predefined macros.gcc compiles C++ files with more number of predefined macros. Some of them are #define __GXX_WEAK__ 1, #define __cplusplus 1, #define __DEPRECATED 1, etc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值