问题描述
我正在 VS 2008 中使用 libtorrent 创建一个 torrent 应用程序.我尝试了链接中给出的示例 http://www.rasterbar.com/products/libtorrent/examples.html但是它向我展示了这些错误......如何解决它们?
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@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@QAE@ABUlazy_entry@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@@AAV12@ABUlazy_entry@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@YAHPBD0AAUlazy_entryH@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall libtorrent::lazy_entry::clear(void)" (?clear@lazy_entry@QAEXXZ) referenced in function "public: __thiscall libtorrent::lazy_entry::~lazy_entry(void)" (??1lazy_entry@QAE@XZ)
main.obj : error LNK2019: unresolved external symbol "void __cdecl libtorrent::to_hex(char const *,int,char *)" (?to_hex@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@@AAV12@ABVbig_number@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@QBE?AUpeer_requestH_JH@Z) referenced in function "public: struct libtorrent::peer_request __thiscall libtorrent::torrent_info::map_file(int,__int64,int)const " (?map_file@torrent_info@QBE?AUpeer_requestH_JH@Z)
C:Usersphotoshop3DocumentsVisual Studio 2008ProjectsLib2DebugLib2.exe : fatal error LNK1120: 7 unresolved externals
推荐答案
.lib 未包含在您的项目中.确保你正在链接它;配置属性 -> 链接器 -> 输入 -> 附加依赖
The .lib is not included in your project. Make sure you are linking it in; Configuration Properties -> Linker -> Input -> Additional Dependencies
另一种选择是简单地将 .lib 复制到您的项目文件夹中,但不要这样做,以后肯定会产生问题.
Another altnerative is to simply copy the .lib to your project folder but don't, it's bound to create problems later on.
有时 .lib 不随库一起提供,因此您需要自己编译它.README 会告诉你这一点.如果是这种情况,它们通常会附带一个 .sln 文件,您可以打开并将其编译成一个 .lib 文件,然后您可以在主应用程序中引用该文件,就像我上面写的
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
这篇关于错误 LNK2019:未解析的外部符号“公共:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!