计算机系统与云计算1续 ubuntu编写C程序

ubuntu编写C程序

root@LAPTOP-TOR03L7R:~# touch flow.c
root@LAPTOP-TOR03L7R:~# vim flow.c
root@LAPTOP-TOR03L7R:~# gcc flow.c
flow.c: In function ‘main’:
flow.c:5:13: warning: integer overflow in expression [-Woverflow]
int b=50000*50000;

root@LAPTOP-TOR03L7R:~# touch beau.c
root@LAPTOP-TOR03L7R:~# vim beau.c
root@LAPTOP-TOR03L7R:~# g++ beau.c -o beau

root@LAPTOP-TOR03L7R:~# ./beau

beautifulroot@LAPTOP-TOR03L7R:~#

1.touch hello.c   新建一个文件名为 hello.c的源程序

2.vim hello.c 编写程序   按i进入insert 模式 

                                      编写完后 按键盘左上角Esc键 键入:wq 按回车退出程序编写模式

3.gcc hello.c 编译程序 如程序编译中为出错 则无显示

                                   如编译中发现错误会在随后的几行中列出

也可用g++ hello.c -o hello

4.运行程序 如编译无误 ./hello 即出现编译结果

猜你喜欢

转载自www.cnblogs.com/wwqdata/p/11459932.html