怎样在Ubuntu上编译gcc命令
怎样在Ubuntu上编译gcc命令
在Ubuntu上编译gcc命令的示例:
1.打开终端,输入以下命令编辑hello.cpp文件。
vim hello.cpp
输入以下代码:
#include
using namespace std;
int main()
{
cout<<"Hello world!"<
return 0; }
保存修改。
2.使用gcc命令进行编译。
gcc hello.cpp -lstdc++ -o hello
//或
g++ hello.cpp -o hello
3.运行可履行文件,在当前目录下输入以下命令查看结果。
./hello
文章来源:丸子建站
文章标题:怎样在Ubuntu上编译gcc命令
https://www.wanzijz.com/view/8095.html