使用Boost.Python修复未解析的外部符号

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用Boost.Python修复未解析的外部符号相关的知识,希望对你有一定的参考价值。

我正在尝试构建一个库并获得几个“未解决的外部符号”错误。我试图解决其中一个错误,这些错误应该让我知道如何继续。该错误是:未解析的外部符号IsProcessorFeaturePresent。根据我的理解,因为这不是我试图构建的代码的一部分,所以必须存在于“lib”文件中。根据this,lib文件应该是kernel32.lib。现在“Windows Kits”下有几个kernel32.lib文件。在Visual Studio Developer命令提示符中编译时,我认为默认情况下应该包括它,因为它应该是环境的一部分。我仍然添加了一个路径“C: Program Files (x86) Windows Kits 8.1 Lib winv6.3 um x64” 在图书馆JamFile的#requirements下我还添加了“ C: Program Files (x86) Windows Kits 8.1 包含 um“到它。但错误没有变化。如何找出它需要包含哪个文件?

注意:这个问题与如何解决未解决的外部符号错误不同,我已经完成了对该问题的回答,现在我正在尝试将其应用于此特定错误。

编辑:我正在尝试构建依赖于Boost.Python的libtorrent库。我在Boost的根目录中使用--with-python = C: Python27构建了Boost.Python。之后,我将BOOST_ROOT添加到环境变量中,并将其添加到路径中。之后我试图使用bjam variant=release memory-model=64构建libtorrent python绑定完整的错误日志是here.

编辑2:继续对这个问题的评论我已经将所需的库添加到JamFile,错误数量从187减少到11.剩下的错误是:

create_torrent.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::python::api::object const & __cdecl boost::python::objects::identity_function(void)" (__imp_?identity_function@objects@python@boost@@YAAEBVobject@api@23@XZ) referenced in function "class boost::python::api::object __cdecl boost::python::objects::detail::demand_iterator_class<struct `anonymous namespace'::FileIter,struct boost::python::return_value_policy<struct boost::python::return_by_value,struct boost::python::default_call_policies> >(char const *,struct `anonymous namespace'::FileIter *,struct boost::python::return_value_policy<struct boost::python::return_by_value,struct boost::python::default_call_policies> const &)" (??$demand_iterator_class@UFileIter@?A0x1efcf82b@@U?$return_value_policy@Ureturn_by_value@python@boost@@Udefault_call_policies@23@@python@boost@@@detail@objects@python@boost@@YA?AVobject@api@23@PEBDPEAUFileIter@?A0x1efcf82b@@AEBU?$return_value_policy@Ureturn_by_value@python@boost@@Udefault_call_policies@23@@23@@Z)
torrent_info.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::python::api::object const & __cdecl boost::python::objects::identity_function(void)" (__imp_?identity_function@objects@python@boost@@YAAEBVobject@api@23@XZ)
create_torrent.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl boost::python::objects::stop_iteration_error(void)" (__imp_?stop_iteration_error@objects@python@boost@@YAXXZ) referenced in function "struct _object * __cdecl boost::python::detail::invoke<struct boost::python::to_python_value<struct libtorrent::file_entry const &>,struct boost::python::objects::iterator_range<struct boost::python::return_value_policy<struct boost::python::return_by_value,struct boost::python::default_call_policies>,struct `anonymous namespace'::FileIter>::next,struct boost::python::arg_from_python<struct boost::python::objects::iterator_range<struct boost::python::return_value_policy<struct boost::python::return_by_value,struct boost::python::default_call_policies>,struct `anonymous namespace'::FileIter> &> >(struct boost::python::detail::invoke_tag_<0,0>,struct boost::python::to_python_value<struct libtorrent::file_entry const &> const &,struct boost::python::objects::iterator_range<struct boost::python::return_value_policy<struct boost::python::return_by_value,struct boost::python::default_call_policies>,struct `anonymous namespace'::FileIter>::next &,struct boost::python::arg_from_python<struct boost::python::objects::iterator_range<struct boost::python::return_value_policy<struct boost::python::return_by_value,struct boost::python::default_call_policies>,struct `anonymous namespace'::FileIter> &> &)" (??$invoke@U?$to_python_value@AEBUfile_entry@libtorrent@@@python@boost@@Unext@?$iterator_range@U?$return_value_policy@Ureturn_by_value@python@boost@@Udefault_call_policies@23@@python@boost@@UFileIter@?A0x1efcf82b@@@objects@23@U?$arg_from_python@AEAU?$iterator_range@U?$return_value_policy@Ureturn_by_value@python@boost@@Udefault_call_policies@23@@python@boost@@UFileIter@?A0x1efcf82b@@@objects@python@boost@@@23@@detail@python@boost@@YAPEAU_object@@U?$invoke_tag_@$0A@$0A@@012@AEBU?$to_python_value@AEBUfile_entry@libtorrent@@@12@AEAUnext@?$iterator_range@U?$return_value_policy@Ureturn_by_value@python@boost@@Udefault_call_policies@23@@python@boost@@UFileIter@?A0x1efcf82b@@@objects@12@AEAU?$arg_from_python@AEAU?$iterator_range@U?$return_value_policy@Ureturn_by_value@python@boost@@Udefault_call_policies@23@@python@boost@@UFileIter@?A0x1efcf82b@@@objects@python@boost@@@12@@Z)
torrent_info.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl boost::python::objects::stop_iteration_error(void)" (__imp_?stop_iteration_error@objects@python@boost@@YAXXZ)
session.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::stl_input_iterator_impl(void)" (__imp_??0stl_input_iterator_impl@objects@python@boost@@QEAA@XZ) referenced in function "public: __cdecl boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??0?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@QEAA@XZ)
torrent_handle.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::stl_input_iterator_impl(void)" (__imp_??0stl_input_iterator_impl@objects@python@boost@@QEAA@XZ)
session.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::stl_input_iterator_impl(class boost::python::api::object const &)" (__imp_??0stl_input_iterator_impl@objects@python@boost@@QEAA@AEBVobject@api@23@@Z) referenced in function "public: __cdecl boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class boost::python::api::object const &)" (??0?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@QEAA@AEBVobject@api@12@@Z)
torrent_handle.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::stl_input_iterator_impl(class boost::python::api::object const &)" (__imp_??0stl_input_iterator_impl@objects@python@boost@@QEAA@AEBVobject@api@23@@Z)
session.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl boost::python::objects::stl_input_iterator_impl::increment(void)" (__imp_?increment@stl_input_iterator_impl@objects@python@boost@@QEAAXXZ) referenced in function "private: static void __cdecl boost::iterators::iterator_core_access::increment<struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >(struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > &)" (??$increment@U?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@@iterator_core_access@iterators@boost@@CAXAEAU?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@2@@Z)
torrent_handle.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl boost::python::objects::stl_input_iterator_impl::increment(void)" (__imp_?increment@stl_input_iterator_impl@objects@python@boost@@QEAAXXZ)
session.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl boost::python::objects::stl_input_iterator_impl::equal(struct boost::python::objects::stl_input_iterator_impl const &)const " (__imp_?equal@stl_input_iterator_impl@objects@python@boost@@QEBA_NAEBU1234@@Z) referenced in function "bool __cdecl boost::iterators::operator!=<struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::input_iterator_tag,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,__int64,struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::input_iterator_tag,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,__int64>(class boost::iterators::iterator_facade<struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::input_iterator_tag,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,__int64> const &,class boost::iterators::iterator_facade<struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::input_iterator_tag,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,__int64> const &)" (??$?9U?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Uinput_iterator_tag@4@V34@_JU012@V34@U54@V34@_J@iterators@boost@@YA_NAEBV?$iterator_facade@U?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Uinput_iterator_tag@5@V45@_J@01@0@Z)
torrent_handle.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl boost::python::objects::stl_input_iterator_impl::equal(struct boost::python::objects::stl_input_iterator_impl const &)const " (__imp_?equal@stl_input_iterator_impl@objects@python@boost@@QEBA_NAEBU1234@@Z)
session.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class boost::python::handle<struct _object> const & __cdecl boost::python::objects::stl_input_iterator_impl::current(void)const " (__imp_?current@stl_input_iterator_impl@objects@python@boost@@QEBAAEBV?$handle@U_object@@@34@XZ) referenced in function "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl boost::iterators::iterator_core_access::dereference<struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >(struct boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > const &)" (??$dereference@U?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@@iterator_core_access@iterators@boost@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBU?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@2@@Z)
torrent_handle.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class boost::python::handle<struct _object> const & __cdecl boost::python::objects::stl_input_iterator_impl::current(void)const " (__imp_?current@stl_input_iterator_impl@objects@python@boost@@QEBAAEBV?$handle@U_object@@@34@XZ)
session.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::~stl_input_iterator_impl(void)" (__imp_??1stl_input_iterator_impl@objects@python@boost@@QEAA@XZ) referenced in function "public: __cdecl boost::python::stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::~stl_input_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??1?$stl_input_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@python@boost@@QEAA@XZ)
torrent_handle.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::~stl_input_iterator_impl(void)" (__imp_??1stl_input_iterator_impl@objects@python@boost@@QEAA@XZ)
torrent_handle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct boost::python::detail::dict_base & __cdecl boost::python::detail::dict_base::operator=(struct boost::python::detail::dict_base &&)" (__imp_??4dict_base@detail@python@boost@@QEAAAEAU0123@$$QEAU0123@@Z) referenced in function "public: class boost::python::dict & __cdecl boost::python::dict::operator=(class boost::python::dict &&)" (??4dict@python@boost@@QEAAAEAV012@$$QEAV012@@Z)
torrent_handle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::stl_input_iterator_impl(struct boost::python::objects::stl_input_iterator_impl const &)" (__imp_??0stl_input_iterator_impl@objects@python@boost@@QEAA@AEBU0123@@Z) referenced in function "public: __cdecl std::vector<int,class std::allocator<int> >::vector<int,class std::allocator<int> ><struct boost::python::stl_input_iterator<int const >,void>(struct boost::python::stl_input_iterator<int const >,struct boost::python::stl_input_iterator<int const >,class std::allocator<int> const &)" (??$?0U?$stl_input_iterator@$$CBH@python@boost@@X@?$vector@HV?$allocator@H@std@@@std@@QEAA@U?$stl_input_iterator@$$CBH@python@boost@@0AEBV?$allocator@H@1@@Z)
torrent_handle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::python::objects::stl_input_iterator_impl::stl_input_iterator_impl(struct boost::python::objects::stl_input_iterator_impl &&)" (__imp_??0stl_input_iterator_impl@objects@python@boost@@QEAA@$$QEAU0123@@Z) referenced in function "public: __cdecl std::vector<int,class std::allocator<int> >::vector<int,class std::allocator<int> ><struct boost::python::stl_input_iterator<int const >,void>(struct boost::python::stl_input_iterator<int const >,struct boost::python::stl_input_iterator<int const >,class std::allocator<int> const &)" (??$?0U?$stl_input_iterator@$$CBH@python@boost@@X@?$vector@HV?$allocator@H@std@@@std@@QEAA@U?$stl_input_iterator@$$CBH@python@boost@@0AEBV?$allocator@H@1@@Z)
binmsvc-14.1
eleaseaddress-model-64libtorrent.dll : fatal error LNK1120: 11 unresolved externals

在qazxsw poi检查qazxsw poi(使用qazxsw poi)我检查了dumpbin的输出中是否存在所有符号,例如搜索libboost_python-vc141-mt-1_65_1.lib我得到这一行:

C:oost_1_65_1stagelib

我在我的JamFile中包含了这个lib文件。我还缺少什么?我在构建dumpbin /EXPORTS时是否需要通过一些选项我正在使用identity_function构建它

答案

根据RbMm的建议,我在JamFile中包含了库,并删除了许多未解决的外部符号错误。其余的错误是通过将Boost.Python构建为共享并包含lib文件来修复的。现在我有一个完全不同的无关错误。

以上是关于使用Boost.Python修复未解析的外部符号的主要内容,如果未能解决你的问题,请参考以下文章

由于 MySql 连接器 C++,如何修复未解析的外部符号?

boost.python 未定义符号问题

函数_main(OPENGL C++)中引用的未解析的外部符号_____________

未引用函数的“未解析的外部符号”

为啥在使用模板时会出现“未解析的外部符号”错误? [复制]

带有 Catch 库的未解析外部符号