G++运行HelloWorld

1.写hello.cpp文件,内容如下:

#include <iostream>

int main (int argc, char **argv) {

printf("hello, world!\n");

return 0;
}

2.编译hello.cpp文件

g++ -o hello.o -c hello.cpp

3.连接

g++ hello.o -o hello.exe

4.运行

./hello.exe

以上几步即可在输出端输出“hello, world!”

欢迎访问SuperMap技术问答社区http://qa.supermap.com/
原文地址:https://www.cnblogs.com/emily_fly/p/1699110.html