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 中链接库


基础教程推荐
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01