Linux+C语言编程实践

基本命令

  1. vi hello.c:打开或新建一个vi hello.c文件
    这里写图片描述
    此时无法编辑,是命令控制模式
    输入i,进入编写界面
    这里写图片描述
    编写之后
    这里写图片描述
    按 Esc进入命令模式
    输入:,进入底行模式,用于输入命令。底行模式下输入 wq保存并退出
    2.gcc hello.c:编译hello.c文件。编译之后会产生几个文件
    3.ls 查看当前目录下的文件
[root@localhost root]# ls
anaconda-ks.cfg  a.out  hello.c  install.log  install.log.syslog  testfile
  1. ./ 运行
[root@localhost root]# ./a.out
hello world

操作记录

[root@localhost root]# vi hello.c
[root@localhost root]# gcc hello.c
/tmp/ccopB62e.o(.text+0x19): In function `main':
: undefined reference to `print'
collect2: ld returned 1 exit status
[root@localhost root]# vi hello.c
[root@localhost root]# gcc hello.c
[root@localhost root]# vi hello.c
[root@localhost root]# ls hello.c
hello.c
[root@localhost root]# ls hello.c
hello.c
[root@localhost root]# gcc hello.c
[root@localhost root]# cat hello.c
#include<stdio.h>

int main(){
    printf("hello world\n");
    return 0;
}
[root@localhost root]# more hello.c
#include<stdio.h>

int main(){
    printf("hello world\n");
    return 0;
}
[root@localhost root]# gcc hello.c
[root@localhost root]#
[root@localhost root]# ls
anaconda-ks.cfg  a.out  hello.c  install.log  install.log.syslog  testfile
[root@localhost root]# ./a.out
hello world
[root@localhost root]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值