0
好吧现在我试图在Linux(Ubuntu 12.04)中使用boost C++库,就像我以前在Windows中使用它们一样。因此,使用一些示例代码从Boost的网站/usr/bin/ld:找不到-llibboost
testfile.cpp
#include <boost/filesystem/convenience.hpp>
#include <boost/foreach.hpp>
#include <boost/range.hpp>
#include <iostream>
int main(int, char**)
{
namespace bf = boost::filesystem;
BOOST_FOREACH(bf::path path,
boost::make_iterator_range(
bf::recursive_directory_iterator(bf::path("/home")),
bf::recursive_directory_iterator())) {
std::cout << path.string() << std::endl;
}
return 0;
}
应该很容易编译使用此命令
g++ -L/usr/local/lib -o "testfile" -llibboost_filesystem
我的问题我收到链接器错误
/usr/bin/ld: cannot find -llibboost_filesystem
并且看起来似乎没有图剔除我缺少的东西。请帮忙。
难道不该'-lboost_filesystem'? – arne
是的,你的权利。我没有意识到文件之间的命名约定在那里改变了。谢谢 – Marstang
[/ usr/bin/ld:找不到-llibboost \ _filesystem]的可能重复(http://stackoverflow.com/questions/11526546/usr-bin-ld-cannot-find-llibboost-filesystem) –