CentOS 7下搭配简单的C语言开发环境
2024-08-27 12:37:02
在CentOS 7下安装gcc,gcc是编译和运行C语言的工具,
安装命令:
yum install gcc
中途如果有询问则输入y
安装成功后,通过以下命令
gcc --version
来查看安装的gcc版本
具体安装可以查看http://www.centoscn.com/image-text/config/2015/0502/5329.html
进行测试:
hello.c的代码
#include <stdio.h>
void main(){
printf("Hello World");
}
对代码进行编译和连接,并生成可执行文件
gcc hello.c -o hello.exe
hello.c为源文件,-o 表示编译并链接,hello.exe为编译结果,可以自定义输出名
更多关于gcc编译的例子可以查看http://man.linuxde.net/gcc
执行编译后的文件
./hello.exe
Linux下执行命令 ./可执行文件名
如果出现cannot execute binary file错误,可以参考https://zhidao.baidu.com/question/455297951.html
最新文章
- 不使用ASP.NET中的服务器控件将如何上传文件?
- 嵌入式linux中使用 DHCP功能描述
- python turtle,random,math
- SQL Server 性能优化之——重复索引
- input[type=";button";]与<;button>;的区别
- Springboot与Mybatis整合
- CTSC&;APIO2017
- JavaWeb学习日记----XML的解析
- (三)underscore.js框架Objects类API学习
- facebook api之Access and Authentication
- 响应式布局与bootstrap框架
- Elasticsearch cluster health: yellow unassigned shards
- 验证码识别 图像降噪 算法 Python (二)
- kafka进阶
- MVC ---- Lambda表达式
- Flutter - Stateful(有状态) 和 stateless(无状态) widgets
- JavaScript运算符:递增和递减(++i,--i 和 i++,i-- 的区别)
- jstorm系列-2:入门
- poj 3249(bfs+dp或者记忆化搜索)
- ArrayList使用