linux程序设计基础—c环境.doc

linux程序设计基础—c环境.doc

ID:51888933

大小:141.00 KB

页数:17页

时间:2020-03-18

linux程序设计基础—c环境.doc_第1页
linux程序设计基础—c环境.doc_第2页
linux程序设计基础—c环境.doc_第3页
linux程序设计基础—c环境.doc_第4页
linux程序设计基础—c环境.doc_第5页
资源描述:

《linux程序设计基础—c环境.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、Linux程序设计基础一C环境一VI编辑器的使用使用VI编辑下列几个函数文件:hello.hstarfun.hhello.cstar.cStarfun.h文件内容如下:/*****starfun.h*****/#ifndefSTARFUN_H#defineSTARFUN_H#defineNUM4#defineNUMBER3intstar1(){intij.k;for(k=l;k<=NUM汁+k){for(i=1;i<=(NUM-k);++i)print"“);for(j=1;j<=(2*k-l);++j)printf(,,*n);printf(uH);)return0;}intstar2

2、(){intij,k;for(k=NUMBER;k>=0;-k){for(i=1;i<=(NUMBER-k+l);++i)printf("“);for(j=1;j<=(2*k-l);++j)printf(,,*H);printf(,fH);}return0;}#endifhello.h文件内容如下:/*hello.h*/#ifndefHELLO.H#defineHELLOHvoidhello(){star1();printf("hello,myfriends");}#cndifhcllo.c文件内容如下:voidshowhello(){hcllo();}star.c文件内容如下:#i

3、ncludc"starfun.h"include”hcllo.h"#includcintmain(){star1();star2();showhello();return0;}Vi编辑器的使用,可以参考PPT,在使用Vi编辑器的过程中,注意使用Vi的单行和多行复制命令,练习字符串查找替换命令,删除一个字符,删除光标后整个内容命令,删除一行命令,恢复删除,保存和退出命令等命令,并尝试使用其他命令。掌握#ifndefSTARFUN_H#defineSTARFUN_H的宏定义用法二・使用gCC编译器,编译程序第一种方法:分步进行1.由star.cstarfun.h文件生成star

4、.oH标文件gcc-cstar.c-ostar.o2.由hello.chello.hstarfun.h生成hello.o0标文件gcc-chello.c-ohello.o3.由hello.ostar.o生成应用程序myproggccstar.ohello.o-omyprog[root@localhost01_helloJ#./myprog*rTerYwrTwrTwrTerY«rTw*******丄"^X9k1><£>•Tw•!•

5、gee编译器编译的过程,并在实验报告中描述在以上编译中尝试[root@localhost01_hello]#geestar.chello.c・omyprog[root@localhost01_hcllo]#gee-wstar.chcllo.c・omyprog[root@localhost01_hello]#gee-Wallstar.chello.c-omyprogInfileincludedfromstar.c:1:starfun.h:InfunctionvstarT:Starfun.h:13:warning:implicitdeclarationoffunction"printfstar.

6、c:Infunction"main1:star.c:8:warning:implicitdeclarationoffunction"showhcllo1hello.c:Infunction'showhello':hello.c:4:warning:implicitdeclarationoffunctionvhello1体会・W11・w选项的作用查阅当前的gee版本命令[root@iocalhost01_hello]#gee-vReadingspecsfrom/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specsConfiguredwith:../conf

7、igure-prefix=/usr—mandir=/usr/share/man・-infodii-/usr/share/info-enable-shared—enable-threads=posix-disable-checking—with-system-zlib-enable-—cxa_atexit・-host=i386-redhat-linuxThreadmodel:posixgeeversion3.2

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。