Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved external when using boost log

I'm having problem while trying to use boost log. I'm getting following error message:

1>------ Build started: Project: vms, Configuration: Release x64 ------
1>  main.cpp
1>  Linking to lib file: libboost_system-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_date_time-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_regex-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_log-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_filesystem-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_date_time-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_thread-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_atomic-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_chrono-vc140-mt-1_60.lib
1>  Linking to lib file: libboost_log_setup-vc140-mt-1_60.lib
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::aux::stream_provider<char>::release_compound(struct boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound *)" (?release_compound@?$stream_provider@D@aux@v2s_mt_nt5@log@boost@@SAXPEAUstream_compound@12345@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static struct boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound * __cdecl boost::log::v2s_mt_nt5::aux::stream_provider<char>::allocate_compound(class boost::log::v2s_mt_nt5::record &)" (?allocate_compound@?$stream_provider@D@aux@v2s_mt_nt5@log@boost@@SAPEAUstream_compound@12345@AEAVrecord@345@@Z)
1>main.obj : error LNK2001: unresolved external symbol "void __cdecl boost::log::v2s_mt_nt5::aux::attach_attribute_name_info(class boost::exception &,class boost::log::v2s_mt_nt5::attribute_name const &)" (?attach_attribute_name_info@aux@v2s_mt_nt5@log@boost@@YAXAEAVexception@4@AEBVattribute_name@234@@Z)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::aux::id<struct boost::log::v2s_mt_nt5::aux::process> __cdecl boost::log::v2s_mt_nt5::aux::this_process::get_id(void)" (?get_id@this_process@aux@v2s_mt_nt5@log@boost@@YA?AV?$id@Uprocess@aux@v2s_mt_nt5@log@boost@@@2345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl boost::log::v2s_mt_nt5::aux::unhandled_exception_count(void)" (?unhandled_exception_count@aux@v2s_mt_nt5@log@boost@@YAIXZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::process_id(void)" (?process_id@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::message(void)" (?message@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::thread_id(void)" (?thread_id@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::timestamp(void)" (?timestamp@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::line_id(void)" (?line_id@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "void __cdecl boost::log::v2s_mt_nt5::aux::code_convert_impl(wchar_t const *,unsigned __int64,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::locale const &)" (?code_convert_impl@aux@v2s_mt_nt5@log@boost@@YAXPEB_W_KAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVlocale@6@@Z)
1>main.obj : error LNK2001: unresolved external symbol "private: void __cdecl boost::log::v2s_mt_nt5::aux::once_block_sentry::rollback(void)" (?rollback@once_block_sentry@aux@v2s_mt_nt5@log@boost@@AEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "private: bool __cdecl boost::log::v2s_mt_nt5::aux::once_block_sentry::enter_once_block(void)const " (?enter_once_block@once_block_sentry@aux@v2s_mt_nt5@log@boost@@AEBA_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::once_block_sentry::commit(void)" (?commit@once_block_sentry@aux@v2s_mt_nt5@log@boost@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::unlock(void)" (?unlock@light_rw_mutex@aux@v2s_mt_nt5@log@boost@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::lock(void)" (?lock@light_rw_mutex@aux@v2s_mt_nt5@log@boost@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::unlock_shared(void)" (?unlock_shared@light_rw_mutex@aux@v2s_mt_nt5@log@boost@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::lock_shared(void)" (?lock_shared@light_rw_mutex@aux@v2s_mt_nt5@log@boost@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::~light_rw_mutex(void)" (??1light_rw_mutex@aux@v2s_mt_nt5@log@boost@@QEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::light_rw_mutex(void)" (??0light_rw_mutex@aux@v2s_mt_nt5@log@boost@@QEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::aux::id<struct boost::log::v2s_mt_nt5::aux::thread> const & __cdecl boost::log::v2s_mt_nt5::aux::this_thread::get_id(void)" (?get_id@this_thread@aux@v2s_mt_nt5@log@boost@@YAAEBV?$id@Uthread@aux@v2s_mt_nt5@log@boost@@@2345@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: class boost::log::v2s_mt_nt5::attribute_value_set::const_iterator __cdecl boost::log::v2s_mt_nt5::attribute_value_set::find(class boost::log::v2s_mt_nt5::attribute_name)const " (?find@attribute_value_set@v2s_mt_nt5@log@boost@@QEBA?AVconst_iterator@1234@Vattribute_name@234@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: class boost::log::v2s_mt_nt5::attribute_value_set::const_iterator __cdecl boost::log::v2s_mt_nt5::attribute_value_set::end(void)const " (?end@attribute_value_set@v2s_mt_nt5@log@boost@@QEBA?AVconst_iterator@1234@XZ)
1>main.obj : error LNK2001: unresolved external symbol "private: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::construct(class boost::filesystem::path const &,int,unsigned __int64,class boost::log::v2s_mt_nt5::aux::light_function<bool __cdecl(void)> const &,bool)" (?construct@text_file_backend@sinks@v2s_mt_nt5@log@boost@@AEAAXAEBVpath@filesystem@5@H_KAEBV?$light_function@$$A6A_NXZ@aux@345@_N@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::flush(void)" (?flush@text_file_backend@sinks@v2s_mt_nt5@log@boost@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::consume(class boost::log::v2s_mt_nt5::record_view const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?consume@text_file_backend@sinks@v2s_mt_nt5@log@boost@@QEAAXAEBVrecord_view@345@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: unsigned __int64 __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::scan_for_files(enum boost::log::v2s_mt_nt5::sinks::file::scan_method,bool)" (?scan_for_files@text_file_backend@sinks@v2s_mt_nt5@log@boost@@QEAA_KW4scan_method@file@2345@_N@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::set_file_collector(class boost::shared_ptr<struct boost::log::v2s_mt_nt5::sinks::file::collector> const &)" (?set_file_collector@text_file_backend@sinks@v2s_mt_nt5@log@boost@@QEAAXAEBV?$shared_ptr@Ucollector@file@sinks@v2s_mt_nt5@log@boost@@@5@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::~text_file_backend(void)" (??1text_file_backend@sinks@v2s_mt_nt5@log@boost@@QEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::attribute_set::~attribute_set(void)" (??1attribute_set@v2s_mt_nt5@log@boost@@QEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::attribute_set::attribute_set(void)" (??0attribute_set@v2s_mt_nt5@log@boost@@QEAA@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::record_view::public_data::destroy(struct boost::log::v2s_mt_nt5::record_view::public_data const *)" (?destroy@public_data@record_view@v2s_mt_nt5@log@boost@@SAXPEBU12345@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::attribute::impl::operator delete(void *,unsigned __int64)" (??3impl@attribute@v2s_mt_nt5@log@boost@@SAXPEAX_K@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static void * __cdecl boost::log::v2s_mt_nt5::attribute::impl::operator new(unsigned __int64)" (??2impl@attribute@v2s_mt_nt5@log@boost@@SAPEAX_K@Z)
1>main.obj : error LNK2001: unresolved external symbol "private: void __cdecl boost::log::v2s_mt_nt5::core::push_record_move(class boost::log::v2s_mt_nt5::record &)" (?push_record_move@core@v2s_mt_nt5@log@boost@@AEAAXAEAVrecord@234@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: class boost::log::v2s_mt_nt5::record __cdecl boost::log::v2s_mt_nt5::core::open_record(class boost::log::v2s_mt_nt5::attribute_set const &)" (?open_record@core@v2s_mt_nt5@log@boost@@QEAA?AVrecord@234@AEBVattribute_set@234@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: struct std::pair<class boost::log::v2s_mt_nt5::attribute_set::iter<0>,bool> __cdecl boost::log::v2s_mt_nt5::core::add_global_attribute(class boost::log::v2s_mt_nt5::attribute_name const &,class boost::log::v2s_mt_nt5::attribute const &)" (?add_global_attribute@core@v2s_mt_nt5@log@boost@@QEAA?AU?$pair@V?$iter@$0A@@attribute_set@v2s_mt_nt5@log@boost@@_N@std@@AEBVattribute_name@234@AEBVattribute@234@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::core::add_sink(class boost::shared_ptr<class boost::log::v2s_mt_nt5::sinks::sink> const &)" (?add_sink@core@v2s_mt_nt5@log@boost@@QEAAXAEBV?$shared_ptr@Vsink@sinks@v2s_mt_nt5@log@boost@@@4@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: bool __cdecl boost::log::v2s_mt_nt5::core::get_logging_enabled(void)const " (?get_logging_enabled@core@v2s_mt_nt5@log@boost@@QEBA_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: static class boost::shared_ptr<class boost::log::v2s_mt_nt5::core> __cdecl boost::log::v2s_mt_nt5::core::get(void)" (?get@core@v2s_mt_nt5@log@boost@@SA?AV?$shared_ptr@Vcore@v2s_mt_nt5@log@boost@@@4@XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::basic_formatter<char> __cdecl boost::log::v2s_mt_nt5::parse_formatter<char>(char const *,char const *)" (??$parse_formatter@D@v2s_mt_nt5@log@boost@@YA?AV?$basic_formatter@D@012@PEBD0@Z)
1>a.exe : fatal error LNK1120: 41 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

I'm not really sure what is wrong. The libraries are there, the linker finds them. Just not symbols in them. Any tips?

like image 541
graywolf Avatar asked Dec 10 '22 18:12

graywolf


1 Answers

Ok, figured it out. Problem was, that boost was compiled with _WIN32_WINNT 0x0601 while I was building with 0x0501. Just changed mine to 0x0601 as well and it linked fine.

like image 61
graywolf Avatar answered Jan 04 '23 10:01

graywolf