How to compile a libtorrent(rasterbar) code ?

2019-07-30 13:48发布

I want to compile example (make_torrent) from libtorrent official website:

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

But I get this error:

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

I have libtorrent-rasterbar installed

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

So how should I compile this source code?

1条回答
太酷不给撩
2楼-- · 2019-07-30 14:25

You need to add libtorrent-rasterbar to the linker. Try the following command:

g++ create_torrent_file.cpp -o run -ltorrent-rasterbar -lboost_filesystem-mt
查看更多
登录 后发表回答