基本命令
- 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
- ./ 运行
[root@localhost root]
hello world
操作记录
[root@localhost root]
[root@localhost root]
/tmp/ccopB62e.o(.text+0x19): In function `main':
: undefined reference to `print'
collect2: ld returned 1 exit status
[root@localhost root]
[root@localhost root]
[root@localhost root]
[root@localhost root]
hello.c
[root@localhost root]
hello.c
[root@localhost root]
[root@localhost root]
int main(){
printf("hello world\n");
return 0;
}
[root@localhost root]
int main(){
printf("hello world\n");
return 0;
}
[root@localhost root]
[root@localhost root]
[root@localhost root]
anaconda-ks.cfg a.out hello.c install.log install.log.syslog testfile
[root@localhost root]
hello world
[root@localhost root]