命令

2011-07-13 42 views
2
 ar crf library.a file1.o file2.o 
     ar rvs library.a.a file1.o file2.o 
     ar rs liblprprint.a lpr_print.o 
     ar rcs library.a file1.o file2.o 

其實我已經一派對靜態庫,我發現可以用來創造的2 gcc.Out靜態庫中搜索在計算器.The以前的答案,這4個命令我想知道的是,這4個命令之間有什麼區別嗎?它們在任何方面創建靜態庫方面有所不同。因爲我們可以遵循一個命令來創建一個靜態庫,但爲什麼我們有4個命令來創建一個靜態庫。這些讓我相信所有4個命令之間必定有區別。我在谷歌上試了一下,但是他們發出了命令,但是我沒有發現它們之間的不同之處。所以有人知道爲什麼我們有4個命令要創建一個靜態庫?他們之間有什麼區別?我的意思是rs,rcs,rvs,爲什麼我們有他們?命令

+0

http://stackoverflow.com/questions/5947067/how-to-create-a-static-library-with-g如果檢查上述答案那個問題人們在肌酸中使用了2個不同的命令靜態庫。爲什麼我們沒有標準命令或者有什麼區別? – niko

回答

2

man ar

-c  Suppresses the diagnostic message that is written 
      to standard error by default when archive is 
      created. 

-r  Replaces or adds files in archive. If archive does 
      not exist, a new archive file is created. 

-v  Gives verbose output. When used with options -d, 
      -r, or -x, the -v option writes a detailed file- 
      by-file description of the archive creation and the 
      constituent files, and maintenance activity. 

-s  Forces the regeneration of the archive symbol table 
      even if ar is not invoked with an option that will 
      modify the archive contents.