2011-03-22 59 views
1

我想從libtorrent official website編譯例子(make_torrent):如何編譯libtorrent(rasterbar)代碼?

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 

所以我應該如何編譯這個源代碼?

+0

嘗試在'g ++'命令的末尾添加'-llibtorrent-rasterbar'。 – sarnold 2011-03-22 11:21:53

回答

2

您需要將libtorrent-rasterbar添加到鏈接器。嘗試以下命令:

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

謝謝它解決了我的問題 – Bdfy 2011-03-22 11:31:49