23 lines
414 B
Markdown
23 lines
414 B
Markdown
|
###### 1、检查gcc是否安装
|
|||
|
|
|||
|
输入`g++`如提示:`g++: fatal error: no input files`说明已经安装gcc环境
|
|||
|
|
|||
|
###### 2、安装gcc环境,如已经安装略过此步骤
|
|||
|
|
|||
|
```shell
|
|||
|
yum install gcc-c++
|
|||
|
```
|
|||
|
|
|||
|
###### 3、编译cpp文件
|
|||
|
|
|||
|
```shell
|
|||
|
g++ -o 编译后的名称 源文件.cpp
|
|||
|
```
|
|||
|
|
|||
|
###### 4、运行
|
|||
|
|
|||
|
```shell
|
|||
|
./编译后的文件名称
|
|||
|
```
|
|||
|
|
|||
|
如运行成功会显示运行结果如“Hello World!”
|