C++ 链接 boost 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10262742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linking boost libraries
提问by Ramy Al Zuhouri
I have downloaded the boost library (version 1.46.1), but I don't know how to link it through xcode.I found an old question says to put the -lfftw3 flag, so I've put it.
I also added the path: /home/Documents/C++/boost_1_46_1 (it's the directory where I have put the library), but I am getting an error from the linker:
我已经下载了 boost 库(版本 1.46.1),但我不知道如何通过 xcode 链接它。我发现一个老问题说要放置 -lfftw3 标志,所以我已经放置了它。
我还添加了路径:/home/Documents/C++/boost_1_46_1(这是我放置库的目录),但是我从链接器收到错误:
ld: warning: directory not found for option '-L/home/ramy/Documents/C++/boost_1_46_1'
ld: library not found for -lfftw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Command /Developer/usr/bin/clang++ failed with exit code 1
So the question are two:
1)How to manage xcode to link boost?
2)Where to put the library in file system? In linux there was /usr/lib, here there isn't this path, should I put it in /Developer/usr/lib?
所以问题是两个:
1)如何管理 xcode 链接提升?
2)将库放在文件系统中的什么位置?linux有/usr/lib,这里没有这个路径,我应该把它放在/Developer/usr/lib中吗?
回答by Wolfer
Or for those who are looking for a quick answer (and are on linux), the magic is simply to add the following flags:
或者对于那些正在寻找快速答案的人(并且在 linux 上),魔术只是添加以下标志:
-l boost_system