Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error LNK2019: unresolved external symbol "public:

I am creating an torrent application using libtorrent in VS 2008. I tried the example given in the link http://www.rasterbar.com/products/libtorrent/examples.html BUt it is showing me these error....how to solve them?

Linking...
main.obj : error LNK2019: unresolved external symbol "public: __thiscall libtorrent::torrent_info::~torrent_info(void)" (??1torrent_info@libtorrent@@QAE@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: __thiscall libtorrent::torrent_info::torrent_info(struct libtorrent::lazy_entry const &)" (??0torrent_info@libtorrent@@QAE@ABUlazy_entry@1@@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "class std::basic_ostream > & __cdecl libtorrent::operator<<(class std::basic_ostream > &,struct libtorrent::lazy_entry const &)" (??6libtorrent@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABUlazy_entry@0@@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "int __cdecl libtorrent::lazy_bdecode(char const *,char const *,struct libtorrent::lazy_entry &,int)" (?lazy_bdecode@libtorrent@@YAHPBD0AAUlazy_entry@1@H@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall libtorrent::lazy_entry::clear(void)" (?clear@lazy_entry@libtorrent@@QAEXXZ) referenced in function "public: __thiscall libtorrent::lazy_entry::~lazy_entry(void)" (??1lazy_entry@libtorrent@@QAE@XZ)
main.obj : error LNK2019: unresolved external symbol "void __cdecl libtorrent::to_hex(char const *,int,char *)" (?to_hex@libtorrent@@YAXPBDHPAD@Z) referenced in function "class std::basic_ostream > & __cdecl libtorrent::operator<<(class std::basic_ostream > &,class libtorrent::big_number const &)" (??6libtorrent@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVbig_number@0@@Z)
main.obj : error LNK2019: unresolved external symbol "public: struct libtorrent::peer_request __thiscall libtorrent::file_storage::map_file(int,__int64,int)const " (?map_file@file_storage@libtorrent@@QBE?AUpeer_request@2@H_JH@Z) referenced in function "public: struct libtorrent::peer_request __thiscall libtorrent::torrent_info::map_file(int,__int64,int)const " (?map_file@torrent_info@libtorrent@@QBE?AUpeer_request@2@H_JH@Z)
C:\Users\photoshop3\Documents\Visual Studio 2008\Projects\Lib2\Debug\Lib2.exe : fatal error LNK1120: 7 unresolved externals
like image 762
amrit_neo Avatar asked Jan 25 '11 06:01

amrit_neo


2 Answers

The .lib is not included in your project. Make sure you are linking it in; Configuration Properties -> Linker -> Input -> Additional Dependencies

Another altnerative is to simply copy the .lib to your project folder but don't, it's bound to create problems later on.

Sometimes the .lib is not shipped with the library, so you need to compile it yourself. The README will tell you this. If this is the case, they usually ship with a .sln file you can open and the just compile it into a .lib file which you then reference in your main application, as I wrote above

like image 125
KaiserJohaan Avatar answered Oct 03 '22 18:10

KaiserJohaan


Have you added the path of header files in the "Configuration Properties" --> "C/C++“ --> "General" --> "Additional Include Directories"?

like image 23
Rui Teng Avatar answered Oct 03 '22 18:10

Rui Teng