cnblogs/dcrenl/centos使用gcc编译c++源码文件(_.cpp).md
2024-09-24 12:43:01 +08:00

23 lines
414 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

###### 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!”