Ubuntu系统实现简单c语言编程

一.Ubuntu系统c语言输出hello world

1.在终端窗口输入vi hello.c创建文件,输入i进入编辑模式开始输入程序,输入完后按esc到命令模式,输入:wq保存并退出。5a52f5cdc83c4195bffe4ed9636d983d.png

 2.使用gcc编译实行可执行文件

在终端窗口输入gcc hello.c -o hello命令编译hello.c 再输入./hello执行输出

c420a9ba4f4549528566db7b10d5928c.png

二.Ubuntu系统下便携编写简单的主程序和子程序

1.编写主程序(创建文件和编写过程与hello world类似)05ba63fb62a6415c9b960670a4a738ae.png 

 2.编写子程序916e2271fb7143ef9391ed9476320cfa.png

3.用gcc命令将主程序和子程序衔接并输出

036900db537f46d2aa525cce7760afbf.png

三.在windows系统下编写简单主程序,子程序605e941675934b6b989eef7022edd4d1.png 

884c81c54cf4404197907dcf459e1733.png 

四.Ubuntu系统用makefile方式编程

1.创建并编译makefile规则文件c8434795e8b946ca91ae47f3d117de93.png 

 

72fa0e6734e543848d1678625ec75637.png保存后在终端窗口输入 make执行

c0fef715b1084b74893ab45b015cb205.png