在Xcode中链接库 [英] Linking Libraries in Xcode
问题描述
我使用的是powerbook(osx 10.5),最近下载并安装了FFTW 3.2(链接文字) 。我已经能够编译和运行一些简单的程序,基于在线教程使用终端:
g ++ main.cpp - lfftw3 -lm
但是,我无法得到相同的程序在Xcode中编译。我得到一个链接错误,符号找不到。 / usr / local / lib中有一个名为libfftw3.a的文件。如何链接?此外,显然图书馆必须按照特定的顺序进行链接,例如:链接文字
感谢任何帮助
要在Xcode中链接到.a库,您需要:
-
双击
-
- 将库的路径添加到库搜索路径 (在搜索路径下)。在你的情况下,这将是/ usr / local / lib
将-lfftw3添加到其他链接器标记(在链接下)
我们使用FFTW这对我们有用!
I'm using a powerbook (osx 10.5) and recently downloaded and installed FFTW 3.2 (link text). I've been able to compile and run some simple programs based on the online tutorial using the terminal:
g++ main.cpp -lfftw3 -lm
However, I can't get the same program to compile in Xcode. I get a linking error, "symbol(s) not found". There is a file called libfftw3.a in /usr/local/lib. How can this be linked? Furthermore, apparently the libraries have to be linked in a particular order, i.e. see: link text
thanks for any help
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!
这篇关于在Xcode中链接库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!