Linking Libraries in Xcode(在 Xcode 中链接库)
问题描述
我使用的是 powerbook (osx 10.5),最近下载并安装了 FFTW 3.2 (link text).我已经能够使用终端根据在线教程编译和运行一些简单的程序:
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
但是,我无法在 Xcode 中编译相同的程序.我收到一个链接错误,未找到符号".在/usr/local/lib 中有一个名为 libfftw3.a 的文件.这怎么可能联系起来?此外,显然这些库必须以特定顺序链接,即参见:链接文本一个>
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
感谢您的帮助
推荐答案
要在 Xcode 中链接到这样的 .a 库,您需要:
To link to a .a library like this in Xcode you need to:
在 Xcode 中双击您的目标或应用程序以打开信息窗口
Double-click on your target or application in Xcode to open the Info window
切换到构建"标签
将 -lfftw3 添加到其他链接器标志"(在链接"下)
Add -lfftw3 to "Other Linker Flags" (under "Linking")
将库的路径添加到库搜索路径"(在搜索路径"下).在您的情况下,这将是/usr/local/lib
Add the path to your library to the "Library Search Paths" (under "Search Paths"). In your case this will be /usr/local/lib
我们使用 FFTW(顺便说一句,它很棒),这对我们有用!
We use FFTW (it's great by the way), this works for us!
这篇关于在 Xcode 中链接库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Xcode 中链接库


- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 静态初始化顺序失败 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 近似搜索的工作原理 2021-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 从python回调到c++的选项 2022-11-16
- C++ 协变模板 2021-01-01