资源描述:
《alp-ch01《起步》advanced-unix-programming-with-linux》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、010430PT015/22/0110:09AMPage1IAdvancedUNIXProgrammingwithLinux1GettingStarted2WritingGoodGNU/LinuxSoftware3Processes4Threads5InterprocessCommunication010430PT015/22/0110:09AMPage2020430CH015/22/0110:19AMPage31GettingStartedTHISCHAPTERSHOWSYOUHOWTOPERFORMTHEBASICstepsrequir
2、edtocreateaCorC++Linuxprogram.Inparticular,thischaptershowsyouhowtocreateandmodifyCandC++sourcecode,compilethatcode,anddebugtheresult.Ifyou’realreadyaccustomedtoprogrammingunderLinux,youcanskipaheadtoChapter2,“WritingGoodGNU/LinuxSoftware;”paycarefulattentiontoSection2.3,“
3、WritingandUsingLibraries,”forinformationaboutstaticversusdynamiclinkingthatyoumightnotalreadyknow.Throughoutthisbook,we’llassumethatyou’refamiliarwiththeCorC++pro-gramminglanguagesandthemostcommonfunctionsinthestandardClibrary.ThesourcecodeexamplesinthisbookareinC,exceptwh
4、endemonstratingaparticularfeatureorcomplicationofC++programming.WealsoassumethatyouknowhowtoperformbasicoperationsintheLinuxcommandshell,suchascreatingdirectoriesandcopyingfiles.BecausemanyLinuxprogrammersgotstartedprogrammingintheWindowsenvironment,we’lloccasionallypointo
5、utsimilaritiesandcontrastsbetweenWindowsandLinux.020430CH015/22/0110:19AMPage44Chapter1GettingStarted1.1EditingwithEmacsAneditoristheprogramthatyouusetoeditsourcecode.LotsofdifferenteditorsareavailableforLinux,butthemostpopularandfull-featurededitorisprobablyGNUEmacs.About
6、EmacsEmacsismuchmorethananeditor.Itisanincrediblypowerfulprogram,somuchsothatatCodeSourcery,itisaffectionatelyknownastheOneTrueProgram,orjusttheOTPforshort.YoucanreadandsendemailfromwithinEmacs,andyoucancustomizeandextendEmacsinwaysfartoonumeroustodiscusshere.Youcanevenbro
7、wsetheWebfromwithinEmacs!Ifyou’refamiliarwithanothereditor,youcancertainlyuseitinstead.NothingintherestofthisbookdependsonusingEmacs.Ifyoudon’talreadyhaveafavoriteLinuxeditor,thenyoushouldfollowalongwiththemini-tutorialgivenhere.IfyoulikeEmacsandwanttolearnaboutitsadvanced
8、features,youmightconsiderreadingoneofthemanyEmacsbooksavailable.Oneexcellenttutorial,Lear