1

I installed the Libtorrent library with vcpkg. I am tring to consume it from a c++ project in VS 2022.

All the Headers are available when I use "#include <libtorrent/any header file>" without showing any errors.

But when I build the project it gives me errors: error LNK2001: unresolved external symbol, one for each function from libtorrent that I call... I assume the .lib file is not linking correctly.

What I have tried:

  1. Make sure my project is the correct architecture (x64).
  2. Properties -> C/C++ -> General -> Additional Include Library "path to include folder".
  3. Properties -> Linker -> Input -> Additional Dependencies "path to .lib file".

Please see extra notes below: "path to include folder" = C:\Users\27815\vcpkg\installed\x64-windows\include "path to .lib file" = C:\Users\27815\vcpkg\installed\x64-windows\lib\torrent-rasterbar.lib

Please advice what I should do/test.

  • my guess would be that some preprocessor define is needed to switch to using dll/static(whichever is used by the vcpkg library) library symbols – Alan Birtles Aug 22 '22 at 16:51
  • I tried following the instructions on the link below, but it did not work... could you suggest specifically what I should be searching for? https://levelup.gitconnected.com/how-to-statically-link-c-libraries-with-vcpkg-visual-studio-2019-435c2d4ace03 – Talon Van Vuuren Aug 22 '22 at 17:15
  • @TalonVanVuuren Your settings are wrong 3. Name of lib file not path to lib file 4. Linker -> General -> Additional Library Directories lib file directory – john Aug 22 '22 at 17:37

0 Answers0