Bonjour,

Je suis débutant en C++, Je veux développer un simple client bittorent en C++ en utilisant la bibliothèque libtorrent implémenté en C++. je travaille sur ubuntu 8.10/

Après le telechargement du code source de la bibliothèque, je l'ai installé en utilisant ./configure, make, make install.

J'ai un petit exemple prêt qui utilise libtorrent que j'ai voulu testé.

Ce code contient des include de fichiers de la bibliothèque : voila l'entête du code source :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
#include "libtorrent/session.hpp"
#include "libtorrent/session_settings.hpp"
#include "libtorrent/hasher.hpp"
#include "libtorrent/create_torrent.hpp"
#include <boost/thread.hpp>
#include <boost/tuple/tuple.hpp>
 
#include "test.hpp"
#include "setup_transfer.hpp"
 
using namespace libtorrent;
     ....
Quand je compile en utilisant g++ test_torrent.cpp -o test_torrent.cpp.exe

j'ai l'erreur suivante :
test_torrent.cpp: (.text+0x2b5): undefined reference to `libtorrent::session::session(libtorrent::fingerprint const&, std::pair<int, int>, char const*, int)'
test_torrent.cpp: (.text+0x2bd): undefined reference to `libtorrent::default_storage_constructor(libtorrent::file_storage const&, boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> const&, libtorrent::file_pool&)'
test_torrent.cpp: (.text+0x30c): undefined reference to `libtorrent::session::add_torrent(libtorrent::add_torrent_params const&)'
test_torrent.cpp: (.text+0x31b): undefined reference to `test_sleep(int)'
test_torrent.cpp: (.text+0x330): undefined reference to `libtorrent::torrent_handle::status() const'
test_torrent.cpp: (.text+0x466): undefined reference to `report_failure(char const*, char const*, int)'
test_torrent.cpp: (.text+0x4fc): undefined reference to `report_failure(char const*, char const*, int)'
test_torrent.cpp: (.text+0x55f): undefined reference to `libtorrent::torrent_handle::prioritize_files(std::vector<int, std::allocator<int> > const&) const'
test_torrent.cpp: (.text+0x5a1): undefined reference to `test_sleep(int)'
test_torrent.cpp: (.text+0x5b6): undefined reference to `libtorrent::torrent_handle::status() const'
test_torrent.cpp: (.text+0x704): undefined reference to `report_failure(char const*, char const*, int)'
test_torrent.cpp: (.text+0x79a): undefined reference to `report_failure(char const*, char const*, int)'
test_torrent.cpp: (.text+0x7c5): undefined reference to `libtorrent::torrent_handle::prioritize_files(std::vector<int, std::allocator<int> > const&) const'
test_torrent.cpp: (.text+0x7d1): undefined reference to `test_sleep(int)'
test_torrent.cpp: (.text+0x7e6): undefined reference to `libtorrent::torrent_handle::status() const'
test_torrent.cpp: (.text+0x90a): undefined reference to `report_failure(char const*, char const*, int)'
test_torrent.cpp: (.text+0x9a0): undefined reference to `report_failure(char const*, char const*, int)'
test_torrent.cpp: (.text+0xaa7): undefined reference to `libtorrent::session::~session()'
test_torrent.cpp: (.text+0xad8): undefined reference to `libtorrent::session::~session()'
Est-ce que quelqu'un peut m'aider à résoudre ce problème?

Ça doit être un problème de référence à la bibliothèque?
Ça fait deux jours que j'essaye de résoudre ce problème sans résultat.

Merci pour votre aide.