2011-07-13 5 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 

を命令し、私はstackoverflowの【選択の前の回答で検索され2のgcc.Outで静的ライブラリを作成するために使用することができ、これらの4つのコマンドを発見しました私が知りたいことは、これらの4つのコマンドに違いはありますか?どのような面でも静的ライブラリの作成方法が異なります。静的ライブラリを作成するコマンドを1つ続けることができますが、静的ライブラリを作成するために4つのコマンドを使用する理由があるからです。これらは4つのコマンドすべてに違いがなければならないと信じさせました。私はGoogleで試してみましたが、コマンドを与えましたが、それらの間の差異は見つけられませんでした。誰が知っているのですか?静的ライブラリですか?それらの違いは何ですか?私はrs、rcs、rvsを意味するのはなぜですか?違いは実際に私は静的ライブラリについてグーグルた

+0

http://stackoverflow.com/questions/5947067/how-to-create-a-static-library-with-gから、あなたは上記の解答を確認した場合その質問の人々は、静的ライブラリの2つの異なるコマンドをcreatinで使用しました。なぜ私たちは標準コマンドを持っていないのですか、それとも何か違いはありますか? – 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. 
関連する問題