編譯iOS使用的.a庫檔案,編譯ios.a庫
首先是需要編譯成.a的源檔案
hello.h:
#ifndef __INCLUDE_HELLO_H__#define __INCLUDE_HELLO_H__void hello(const char *name);#endif // end __INCLUDE_HELLO_H__
hello.c
#include "stdio.h"void hello(const char *name){ printf("Hello world %s\n", name);}
1、用xcode建立一個library的工程
2、進行配置
刪掉原來的.h和.m:
把上面的.c和.h加入到工程中:
設定項目的最低配置為iOS6.0
3、編譯一下,得到libhello.a
開啟到目錄中,可以查看,已經同時產生了模擬器的.a庫和真機的.a 庫
4、在測試專案進行測試所產生的.a庫
模擬器的:
真機的(需要載入的庫注意是不一樣的):
5、把真機庫和模擬器庫合并到一塊
用lipo -create (要合并到一起的三個檔案) -output (合并到一起的檔案名稱)
首先我把這兩個檔案複製到案頭,然後修改對應的名字,一個為libhelloi386.a另一個為libhello7.a,然後在終端執行下面的命令:
6、整個測試專案的(包含iOS測試專案和lib庫項目)
csdn:http://download.csdn.net/detail/zengraoli/8115253
IOS的A檔案怎解壓? 靜態庫的
右鍵以壓縮包形式解壓啊
編譯minix作業系統時,總有提示沒有找到尾碼名為a的檔案,a檔案是什檔案?怎產生?
.a檔案是.o檔案的集合,可用ar -tv命令查看裡麵包含的.o檔案。
ADS編譯選項小技巧
2005-12-01 12:50
今天收到了中文之星發來的IME檔案,發現產生的庫檔案是.a尾碼的,因為習慣使用.lib形式的尾碼,又擔心直接修改尾碼名稱會出問題,所以想研究一下怎麼把.a修改成.lib檔案。
命令列模式下輸入armar查詢參數,發現了幾個比較需要的參數:
-x Extract members in <file_list> placing in files of the same name.
-t Print table of contents of archive.
-create Force creation of a new archive.
於是,輸入armar -t csk2.a查看了庫檔案的組成檔案清單,然後輸入armar -x csk2.a解壓出全部.o檔案,最後armar -create csk2.lib *.o,成功產生csk2.lib。比較csk2.a和csk2.lib發現有一個數字不一樣,估計是產生時間不一樣,現在想想或許直接改尾碼就可以了。雖然走了彎路,但是通過查詢編譯參數還發現了不少好用的功能,這裡就不列舉了附上參數表,自己慢慢研究。
-r Insert files in <file_list>, replace existing members of the same name.
-d Delete the members in <file_list>.
-x Extract members in <file_list> placing in files of the same name.
-m Move files in <file_list>.
-p Print files to stdout.
-a pos Insert/move files after file named <pos>.
-b pos Insert/move files before file named <pos>.
-u Update older files only, used with -r.
-n Do not add a symbol table to an object archive.
-s Force regeneration of archive symbol table.
-t Print table of contents of archive.
-zs Show the symbol table.
-zt Summarize the archive contents (sizes + entries).
-c Suppress warning when a new archive is created.
-C Do not overwrite existing files when extracting.
-T Truncate file names to system maximum length.
-v Give verbose output.
-create Force creation of a new archive.
-via file Take additional arguments from via file.
-sizes List th......餘下全文>>