如何编译libtorrent(rasterbar)代码?

时间:2011-03-22 11:16:31

标签: boost compilation g++ libtorrent

我想从libtorrent official website编译示例(make_torrent):

g++ create_torrent_file.cpp -o run -lboost_filesystem-mt 

但是我收到了这个错误:

create_torrent_file.cpp:(.text+0x158): undefined reference to
`libtorrent::file_storage::file_storage()'

我安装了libtorrent-rasterbar

ldconfig -v | grep libtorrent:
libtorrent-rasterbar.so.6 -> libtorrent-rasterbar.so.6.0.0

那么我应该如何编译这个源代码呢?

1 个答案:

答案 0 :(得分:2)

您需要将libtorrent-rasterbar添加到链接器。请尝试以下命令:

g++ create_torrent_file.cpp -o run -ltorrent-rasterbar -lboost_filesystem-mt