-1

I am trying to build a library and getting several "unresolved external symbol" errors. I am trying to fix one of those errors which should give me an idea of how to proceed. That error is: unresolved external symbol IsProcessorFeaturePresent. As per my understanding since this is not part of the code I am trying to build this must be present in a "lib" file. According to this that lib file should be kernel32.lib. Now there are several kernel32.lib files present under "Windows Kits". Which I suppose should be included by default when compiling in Visual Studio Developer Command Prompt as it should be a part of the environment. I still added a path "C:\Program\ Files\ (x86)\Windows\ Kits\8.1\Lib\winv6.3\um\x64" to <library-path> under #requirements in JamFile of the library I have also added "<include>C:\Program\ Files\ (x86)\Windows\ Kits\8.1\Include\um" to it. But there is no change in the error. How do I find out which file does it require to be included?

Note: This question is different from how to resolve unresolved external symbol error, I have already gone through answers to that question and now I am trying to apply it to this particular error.

Edit:I am trying to build the libtorrent library which depends on Boost.Python. I built Boost.Python using --with-python=C:\Python27 in Boost's root directory. After This I have added BOOST_ROOT to the environment variables and also added it to path. After that I am trying to build libtorrent python bindings using bjam variant=release memory-model=64 The complete error logs are here.

Edit 2: Following up on the comments to this question I have added the required libraries to JamFile and the number of errors has been reduced from 187 to 11. The remaining errors are:

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)
bin\msvc-14.1\release\address-model-64\libtorrent.dll : fatal error LNK1120: 11 unresolved externals

On inspection of libboost_python-vc141-mt-1_65_1.lib at C:\boost_1_65_1\stage\lib (using dumpbin /EXPORTS) I checked that all the symbols are present in the output of dumpbin, for example searching for identity_function I get this line:

06B 00000000 SECT28 notype ()    External     | ?identity_function@objects@python@boost@@YAAEBVobject@api@23@XZ (class boost::python::api::object const & __cdecl boost::python::objects::identity_function(void))

I am including this lib file in my JamFile. What else am I missing? Is there some option I need to pass while building Boost.Python currently I am building it using bjam --with-python variant=release address-model=64

valiano
  • 16,433
  • 7
  • 64
  • 79
Ravi
  • 727
  • 6
  • 19
  • Which IDE are you using? – JTejedor Dec 09 '17 at 11:21
  • I am compiling on the command line using bjam. The compiler is msvc – Ravi Dec 09 '17 at 11:23
  • Which library you are trying to build? Boost? I think you should explain better your environment. Write the error and the commands you are using, instead only describe the problem. – JTejedor Dec 09 '17 at 11:35
  • you not add `kernel32.lib` to linker input. and `kernel32.lib` not added by default. you need explicit add it – RbMm Dec 09 '17 at 12:06
  • I have added "C:\Program\ Files\ (x86)\Windows\ Kits\8.1\Lib\winv6.3\um\x64" to library path and kernel32.lib is in that path. How else to add it when using bjam – Ravi Dec 09 '17 at 12:15
  • You are trying to compile using the command `bjam variant=release memory-model=64` but in the error log I see a configuration based on 32-bits `- 32-bit : yes (cached)` and `- x86 : yes (cached)`. – JTejedor Dec 09 '17 at 12:56
  • @Ravi - you need add name `kernel32.lib` but not path only. path - this where search for name. but name `kernel32.lib` is mandatory add – RbMm Dec 09 '17 at 15:02
  • This answers the question, the error mentioned IsProcessorFeaturePresent is gone. Now I have 60 (Down from 187) errors. Are there other lib files I need to include manually? – Ravi Dec 09 '17 at 15:18
  • @Ravi - this is very easy - copy name of any unresolved symbol and search **exactly** this name in lib files. which containing - include – RbMm Dec 09 '17 at 15:25
  • Will do. Please add your comment as an answer so I can accept it as an answer. – Ravi Dec 09 '17 at 15:26
  • for example `__imp__invalid_parameter_noinfo_noreturn` exist in `ucrt.lib` - try add it and see result – RbMm Dec 09 '17 at 15:28
  • I solved with static linking, check this answer: https://stackoverflow.com/questions/35367469/force-cmake-visualstudio-to-use-static-libs-of-boost-python – LZh Apr 19 '22 at 19:37

1 Answers1

0

Following RbMm's suggestion I included the libaries in the JamFile and it removed a lot of unresolved external symbol errors. The rest of the errors were fixed by building Boost.Python as shared and including the lib file. Now I have a completely different unrelated error.

Ravi
  • 727
  • 6
  • 19