4
votes

I'm trying to build a simple code (examples/simple_client.cpp) using libtorrent-rasterbar with VS2013 (C++), but I get the following linker error:

error LNK2019: unresolved external symbol "void __cdecl libtorrent::rel_performancetimer_pools_nolog_resolvecountries_deprecated_nodht_ext_(void)" (?rel_performancetimer_pools_nolog_resolvecountries_deprecated_nodht_ext_@libtorrent@@YAXXZ) referenced in function "public: __thiscall libtorrent::session::session(struct libtorrent::fingerprint const &,int,unsigned int)" (??0session@libtorrent@@QAE@ABUfingerprint@1@HI@Z)

I compile libtorrent using: bjam toolset=msvc-12.0 link=static variant=debug boost=source and link everything in VS:

  • libboost_system-vc120-mt-gd-1_55.lib
  • libboost_date_time-vc120-mt-gd-1_55.lib
  • libtorrent.lib

Additional info: libtorrent-rasterbar-0.16.15; boost_1_55_0; Windows 8.1 64bits.

Any ideas on what's going wrong here?

Thank you.

1
I've seen the same problem in VS2012 days ago.Hernán
did you have included also library paths in your project? It also seems from the error that that method uses some deprecated code. Maybe you must define some define in library compilation in order to use it?Jepessen
Yes, I've included lib paths. According to libtorrent doc, the build flag 'deprecated-functions' is set to on by default.user1697973
did you check the RSP response files in the output bjam directories to see which #define symbols you need ?Hernán
I just checked it (libtorrent.lib.rsp), but it only lists .obj files (sorry, I'm not really familiar with bjam builds).user1697973

1 Answers

7
votes

After some research and tests, I managed to build the project. That's what I did:

  1. Compiled using bjam toolset=msvc-12.0 geoip=off resolve-countries=off link=static variant=debug boost=source that way geoip and resolve-countries is disabled.

  2. Using @Hernán's tip of checking the libtorrent RSP files, I got the following preprocessor definitions:

    • BOOST_ASIO_SEPARATE_COMPILATION
    • BOOST_ALL_NO_LIB
    • BOOST_ASIO_ENABLE_CANCELIO
    • BOOST_ASIO_HASH_MAP_BUCKETS=1021
    • BOOST_EXCEPTION_DISABLE
    • BOOST_SYSTEM_STATIC_LINK=1
    • TORRENT_DISABLE_GEO_IP
    • TORRENT_DISABLE_RESOLVE_COUNTRIES
    • TORRENT_USE_I2P=1
    • TORRENT_USE_TOMMATH
    • UNICODE
    • WIN32_LEAN_AND_MEAN
    • _CRT_SECURE_NO_DEPRECATE
    • _FILE_OFFSET_BITS=64
    • _SCL_SECURE_NO_DEPRECATE
    • _UNICODE
    • _WIN32
    • _WIN32_WINNT=0x0500
    • __USE_W32_SOCKETS
  3. I added these definitions in VS. For debug configuration, one more definition was necessary: TORRENT_DEBUG (important).

Some websites I used:

Thank you for the help.