2010-11-04 12:18:11|  分类: iOS 应用开发|字号 订阅

 
 
neogui 2008-09-01 15:57
Q: 如何在XCode中使用gcc编译生成的.a库文件?
1. 把你的.a文件添加到^projectName下的任意一個組里(例如默認的Classes組)。
2. 找到Target > ^targetName,在這個^targetName下會有Link Binary With Libraries。把你已經在某組里的那個.a文件拖到Link Binary With Libraries這個Build Phase中。(也可能同時也要添加到某個Copy的Build Phase中...)
3. 提供一個可用的頭文件。
4. Build and Go.

neogui 2008-09-01 15:58
封裝的話,標準的Cocoa做法是用Cocoa Framework。也就是在新建工程的時候,選擇Cocoa Framework。

waza 2008-09-02 02:20
do shell script "
cd ~/Documents/iphone_svn/iphone/Projects/GTLib;
ar crv ./lib/libgtlibd.a ./build/GTLib.build/Debug-iphoneos/GTLib.build/Objects-normal/armv6/GT*.o;
ar crv ./lib/libgtlibsd.a ./build/GTLib.build/Debug-iphonesimulator/GTLib.build/Objects-normal/i386/GT*.o;
ar crv ./lib/libgtlib.a ./build/GTLib.build/Release-iphoneos/GTLib.build/Objects-normal/armv6/GT*.o;
ar crv ./lib/libgtlibs.a ./build/GTLib.build/Release-iphonesimulator/GTLib.build/Objects-normal/i386/GT*.o;
"


给你个例子,你把路径什么的改掉就可以了

2.
To link to a .a library like this in Xcode you need to:
  • Double-click on your target or application in Xcode to open the Info window

  • Switch to the "Build" tab

  • Add -lfftw3 to "Other Linker Flags" (under "Linking")

  • Add the path to your library to the "Library Search Paths" (under "Search Paths"). In your case this will be /usr/local/lib

We use FFTW (it's great by the way), this works for us!

posted on 2012-03-04 16:11  知识天地  阅读(5301)  评论(0编辑  收藏  举报