日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

linux下g++和gcc_Linux中gcc和g ++有什么区别?

發(fā)布時(shí)間:2023/12/1 linux 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下g++和gcc_Linux中gcc和g ++有什么区别? 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

linux下g++和gcc

gcc和g ++之間的區(qū)別 (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中用于編譯和運(yùn)行C和C ++程序的編譯器 。 最初, gcc是GNU C編譯器,但如今,今天的GCC(GNU編譯器集合)提供了許多編譯器,其中兩個(gè)是: 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 ++程序。 因?yàn)?#xff0c;C程序也可以通過(guò)g ++編譯,因?yàn)樗菙U(kuò)展的,或者可以說(shuō)是C編程語(yǔ)言的高級(jí)編譯器。

編譯器命令通過(guò)gcc編譯C程序 (Compiler command to compile C program through gcc)

gcc program.c -o binary

program.c is the C source file name and binary is the name of binary (object file) that will be executed.

program.c是C源文件的名稱,binary是將要執(zhí)行的二進(jìn)制文件(目標(biāo)文件)的名稱。

通過(guò)g ++編譯C ++程序的編譯器命令 (Compiler command to compile C++ program through g++)

g++ program.cpp -o binary

program.cpp is the C++ source file name and binary is the name of binary (object file) that will be executed.

program.cpp是C ++源文件的名稱,binary是將要執(zhí)行的二進(jìn)制文件(目標(biāo)文件)的名稱。

C示例(main.c)-編譯,通過(guò)gcc運(yùn)行 (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)-編譯,通過(guò)g ++運(yùn)行 (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

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的linux下g++和gcc_Linux中gcc和g ++有什么区别?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。