欢迎来到天天文库
浏览记录
ID:34494396
大小:158.59 KB
页数:36页
时间:2019-03-06
《unix 课件new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、四、UNIX环境下的C程序设计1.UNIX下的C编程工具(GNU)2.基本的C程序设计过程3.Howtowriteamakefile4.DebugaCprogramwithgdb5.UNIX环境下的基本C程序设计1)FileI/O2)Fileanddirectory3)Allocatedynamicmemory4)TimeandDate5)Stringhandling6)CreateCLibrary7)ProcessControl1.UNIX下的C编程工具(GNU)gccGNUprojectCan
2、dC++compilermakeGNUmakeutilitytomaintaingroupsofprogramsgdbTheGNUdebuggerautoconfautomakeAnalyzetheperformanceofCprogramlibtool———————————————————strace......getstatgprofindent>>Csourcefiles==>excutablefile==>vihello.ccathello.c#includemain()
3、{printf(“HelloSJTU!”);}==>gcchello.cgcchello.c-ohellols./helloa.outhello.cHelloSJTU!==>./a.outHelloSJTU!>>gccgcc-g-omy_proghello.cgcc[options]infile...-c——Createlinkableobjectfileforeachsourcefile,butdonotcalllinker.-ofilename——Specifyoutputfileasfi
4、le.Defaultisa.out.-xlanguage——Expectinputfiletobewritteninlanguage(c,c++,assenbl-v——Verbosemode.Displaycommandsastheyareexecuted,gccversionnumber,andpreprocessorversionnumber.-S——Compilesourcefilesintoassemblercode,butdonotassembl-E——Preprocessthesour
5、cefiles,butdonotcompile.-O[level]——Optimize.levelshouldbe1,2,3,or0.Thedefaultis1.0turnsoffoptimization;3optimizes-g——Includedebugginginformationforusewithgdb.......[root@localhost~]#gcc--helpUsage:gcc[options]file...Options:-pass-exit-codesExitwithhig
6、hesterrorcodefromaphase--helpDisplaythisinformation--target-helpDisplaytargetspecificcommandlineoptions(Use'-v--help'todisplaycommandlineoptionsofsub-processes)-dumpspecsDisplayallofthebuiltinspecstrings-dumpversionDisplaytheversionofthecompiler-dumpm
7、achineDisplaythecompiler'stargetprocessorOptiontypes:==>mangccCLanguageOptionsC++LanguageOptionsWarningOptionsDebuggingOptionOptimizationOptionsPreprocessorOptionsAssemblerOptionsLinkerOptionsDirectoryOptionsTargetOptionsMachineDependentOptionsCodeGen
8、erationOptions……>>makeandmakefilemakeutility——determineautomaticallywhichpiecesofalargeprogramneedtoberecompiledandissuethecommandsmaketorecompilethemmakecleanBydefault,whenmakelooksforthemakefile,ittriesthefollowingnames,inorder:`GNUmakefile'
此文档下载收益归作者所有