linux下g++和gcc_Linux中gcc和g ++有什么区别?
linux下g++和gcc
gcc和g ++之間的區別 (Difference between gcc and g++)
Both are the compilers in Linux to compile and run C and C++ programs. Initially gcc was the GNU C Compiler but now a day's GCC (GNU Compiler Collections) provides many compilers, two are: gcc and g++.
兩者都是Linux中用于編譯和運行C和C ++程序的編譯器 。 最初, gcc是GNU C編譯器,但如今,今天的GCC(GNU編譯器集合)提供了許多編譯器,其中兩個是: gcc和g ++ 。
gcc is used to compile C program while g++ is used to compile C++ program. Since, a C program can also be compile complied through g++, because it is the extended or we can say advance compiler for C programming language.
gcc用于編譯C程序,而g ++用于編譯C ++程序。 因為,C程序也可以通過g ++編譯,因為它是擴展的,或者可以說是C編程語言的高級編譯器。
編譯器命令通過gcc編譯C程序 (Compiler command to compile C program through gcc)
gcc program.c -o binaryprogram.c is the C source file name and binary is the name of binary (object file) that will be executed.
program.c是C源文件的名稱,binary是將要執行的二進制文件(目標文件)的名稱。
通過g ++編譯C ++程序的編譯器命令 (Compiler command to compile C++ program through g++)
g++ program.cpp -o binaryprogram.cpp is the C++ source file name and binary is the name of binary (object file) that will be executed.
program.cpp是C ++源文件的名稱,binary是將要執行的二進制文件(目標文件)的名稱。
C示例(main.c)-編譯,通過gcc運行 (C Example (main.c) - Compile, Run through gcc)
/* main.c */#include <stdio.h>int main() {printf("Hello, World!\n");return 0; }Output
輸出量
sh-4.3$ gcc main.c -o mainsh-4.3$ ./mainHello, World! .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}C ++示例(main.cpp)-編譯,通過g ++運行 (C++ Example (main.cpp) - Compile, Run through g++)
/* main.cpp */#include <iostream>using namespace std;int main() {cout << "Hello World" << endl; return 0; }Output
輸出量
sh-4.3$ g++ main.cpp -o mainsh-4.3$ ./mainHello, World!翻譯自: https://www.includehelp.com/c-programming-questions/difference-between-gcc-and-g.aspx
linux下g++和gcc
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的linux下g++和gcc_Linux中gcc和g ++有什么区别?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 地下城领主之塔短剑属性
- 下一篇: c ++查找字符串_C ++数组| 查找