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?
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.
But this program or application you created works in windows 7 or more. It does not supports for Windows XP.
If you want to create application that supports for windows XP, then you can use BOOST 1.58 version.
This version is last which supports from Windows XP. Then later versions supports more than windows XP (i.e.)From vista only.
Related
I ran as suggested in https://stackoverflow.com/a/67875527/433718
vcpkg install grpc:x64-windows
vcpkg install protobuf protobuf:x64-windows
vcpkg install protobuf[zlib] protobuf[zlib]:x64-windows
vcpkg integrate install
Hence, those packages are installed now on my computer:
vcpkg list
abseil:x64-windows 2021-03-24#1 an open-source collection designed to augment th...
c-ares:x64-windows 1.17.1#2 A C library for asynchronous DNS requests
grpc:x64-windows 1.37.0#3 An RPC library and framework
grpc[codegen]:x64-windows Build code generator machinery
openssl:x64-windows 1.1.1k#8 OpenSSL is an open source project that provides ...
protobuf:x64-windows 3.15.8#4 Protocol Buffers - Google's data interchange format
protobuf:x86-windows 3.15.8#4 Protocol Buffers - Google's data interchange format
protobuf[zlib]:x64-windows ZLib based features like Gzip streams
protobuf[zlib]:x86-windows ZLib based features like Gzip streams
re2:x64-windows 2020-10-01 RE2 is a fast, safe, thread-friendly alternative...
upb:x64-windows 2020-12-19#1 μpb (often written 'upb') is a small protobuf i...
zlib:x64-windows 1.2.11#11 A compression library
zlib:x86-windows 1.2.11#11 A compression library
Here's my code:
#include <grpcpp/grpcpp.h>
using grpc::ServerBuilder;
int main(int argc, char** argv) {
ServerBuilder builder;
return 0;
}
I haven't configured any paths (e.g. Additional Dependencies) in the properties as I am using vcpkg (I suppose that's the point of using vcpkg). Here's the config page of vcpkg:
My project doesn't build in Visul Studio 2019 due to 27 unresolved externals...
1>grpc.lib(iomgr_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSAStartup referenced in function "void __cdecl winsock_init(void)" (?winsock_init##YAXXZ)
1>grpc.lib(iomgr_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSACleanup referenced in function "void __cdecl winsock_shutdown(void)" (?winsock_shutdown##YAXXZ)
1>grpc.lib(socket_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_bind referenced in function "void __cdecl probe_ipv6_once(void)" (?probe_ipv6_once##YAXXZ)
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_bind
1>grpc.lib(tcp_client_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_bind
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_bind
1>grpc.lib(socket_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_closesocket referenced in function "void __cdecl grpc_winsocket_shutdown(struct grpc_winsocket *)" (?grpc_winsocket_shutdown##YAXPEAUgrpc_winsocket###Z)
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_closesocket
1>grpc.lib(tcp_client_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_closesocket
1>address_sorting.lib(address_sorting_windows.c.obj) : error LNK2001: unresolved external symbol __imp_closesocket
1>grpc.lib(socket_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_socket referenced in function "void __cdecl probe_ipv6_once(void)" (?probe_ipv6_once##YAXXZ)
1>address_sorting.lib(address_sorting_windows.c.obj) : error LNK2001: unresolved external symbol __imp_socket
1>grpc.lib(resolve_address_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(tcp_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(socket_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(iocp_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(tcp_client_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAIoctl
1>grpc.lib(socket_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAIoctl
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAIoctl
1>grpc.lib(tcp_client_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAIoctl
1>grpc.lib(tcp_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAIoctl
1>grpc.lib(socket_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSASocketA referenced in function "void __cdecl grpc_wsa_socket_flags_init(void)" (?grpc_wsa_socket_flags_init##YAXXZ)
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSASocketA
1>grpc.lib(tcp_client_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSASocketA
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSASocketA
1>grpc.lib(iocp_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSAGetOverlappedResult referenced in function "enum grpc_iocp_work_status __cdecl grpc_iocp_work(__int64)" (?grpc_iocp_work##YA?AW4grpc_iocp_work_status##_J#Z)
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetOverlappedResult
1>grpc.lib(tcp_client_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetOverlappedResult
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSAGetOverlappedResult
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_getpeername referenced in function "void __cdecl on_accept(void *,struct grpc_error *)" (?on_accept##YAXPEAXPEAUgrpc_error###Z)
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_getsockname referenced in function "struct grpc_error * __cdecl prepare_socket(unsigned __int64,struct grpc_resolved_address const *,int *)" (?prepare_socket##YAPEAUgrpc_error##_KPEBUgrpc_resolved_address##PEAH#Z)
1>grpc.lib(tcp_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_getsockname
1>address_sorting.lib(address_sorting_windows.c.obj) : error LNK2001: unresolved external symbol __imp_getsockname
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_listen referenced in function "struct grpc_error * __cdecl prepare_socket(unsigned __int64,struct grpc_resolved_address const *,int *)" (?prepare_socket##YAPEAUgrpc_error##_KPEBUgrpc_resolved_address##PEAH#Z)
1>grpc.lib(tcp_server_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_setsockopt referenced in function "void __cdecl on_accept(void *,struct grpc_error *)" (?on_accept##YAXPEAXPEAUgrpc_error###Z)
1>grpc.lib(tcp_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_setsockopt
1>grpc.lib(resolve_address_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_getaddrinfo referenced in function "struct grpc_error * __cdecl windows_blocking_resolve_address(char const *,char const *,struct grpc_resolved_addresses * *)" (?windows_blocking_resolve_address##YAPEAUgrpc_error##PEBD0PEAPEAUgrpc_resolved_addresses###Z)
1>grpc.lib(resolve_address_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_freeaddrinfo referenced in function "struct grpc_error * __cdecl windows_blocking_resolve_address(char const *,char const *,struct grpc_resolved_addresses * *)" (?windows_blocking_resolve_address##YAPEAUgrpc_error##PEBD0PEAPEAUgrpc_resolved_addresses###Z)
1>grpc.lib(tcp_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSARecv referenced in function "void __cdecl on_read(void *,struct grpc_error *)" (?on_read##YAXPEAXPEAUgrpc_error###Z)
1>grpc.lib(tcp_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSASend referenced in function "void __cdecl on_write(void *,struct grpc_error *)" (?on_write##YAXPEAXPEAUgrpc_error###Z)
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2001: unresolved external symbol __imp_WSASend
1>grpc.lib(socket_utils_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_htonl referenced in function "unsigned int __cdecl grpc_htonl(unsigned int)" (?grpc_htonl##YAII#Z)
1>address_sorting.lib(address_sorting.c.obj) : error LNK2001: unresolved external symbol __imp_htonl
1>grpc.lib(socket_utils_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_htons referenced in function "unsigned short __cdecl grpc_htons(unsigned short)" (?grpc_htons##YAGG#Z)
1>grpc.lib(grpc_ares_wrapper.cc.obj) : error LNK2001: unresolved external symbol __imp_htons
1>grpc.lib(parse_address.cc.obj) : error LNK2001: unresolved external symbol __imp_htons
1>grpc.lib(socket_utils_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_ntohl referenced in function "unsigned int __cdecl grpc_ntohl(unsigned int)" (?grpc_ntohl##YAII#Z)
1>grpc.lib(socket_utils_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_ntohs referenced in function "unsigned short __cdecl grpc_ntohs(unsigned short)" (?grpc_ntohs##YAGG#Z)
1>grpc.lib(grpc_ares_wrapper.cc.obj) : error LNK2001: unresolved external symbol __imp_ntohs
1>grpc.lib(socket_utils_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_inet_pton referenced in function "int __cdecl grpc_inet_pton(int,char const *,void *)" (?grpc_inet_pton##YAHHPEBDPEAX#Z)
1>grpc.lib(socket_utils_windows.cc.obj) : error LNK2019: unresolved external symbol inet_ntop referenced in function "char const * __cdecl grpc_inet_ntop(int,void const *,char *,unsigned __int64)" (?grpc_inet_ntop##YAPEBDHPEBXPEAD_K#Z)
1>grpc.lib(ssl_transport_security.cc.obj) : error LNK2001: unresolved external symbol inet_ntop
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSASetLastError referenced in function "public: __cdecl grpc_core::WSAErrorContext::~WSAErrorContext(void)" (??1WSAErrorContext#grpc_core##QEAA#XZ)
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSAConnect referenced in function "public: int __cdecl grpc_core::GrpcPolledFdWindows::ConnectUDP(class grpc_core::WSAErrorContext *,struct sockaddr const *,int)" (?ConnectUDP#GrpcPolledFdWindows#grpc_core##QEAAHPEAVWSAErrorContext#2#PEBUsockaddr##H#Z)
1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj) : error LNK2019: unresolved external symbol __imp_WSARecvFrom referenced in function "public: void __cdecl grpc_core::GrpcPolledFdWindows::ContinueRegisterForOnReadableLocked(void)" (?ContinueRegisterForOnReadableLocked#GrpcPolledFdWindows#grpc_core##QEAAXXZ)
1>address_sorting.lib(address_sorting_windows.c.obj) : error LNK2019: unresolved external symbol __imp_connect referenced in function address_sorting_create_source_addr_factory_for_current_platform
I build in the Debug and x64 configuration.
What am I missing? I thought vcpkg shall make life easier?
It seems to be a problem of the grpc package.
2nd part of the accepted answer of Linking gRPC on Windows for VisualC++ exactly fixed my problem.
I added #pragma comment(lib, "Ws2_32.lib") to my cpp-file and the problem was gone.
It also can be fixed like so (I've taken the screenshot from Unresolved external symbol LNK2019):
I'm having a bit of trouble compiling a project of mine using Code::Blocks and llvm-clang on Windows 10. Here's some of the error msg as its waay too long to fit in fully, but all of what should be needed is in there.
clang++.exe -LC:\Qub3d\cinder_master\lib -o bin\Debug\Qub3d.exe obj\Debug\src\mainMenus\mainMenu.o obj\Debug\src\Qub3d_EngineApp.o ..\Qub3d-libs\lib\msw\x64\libEGL.lib ..\Qub3d-libs\lib\msw\x64\libGLESv2.lib ..\Qub3d-libs\lib\msw\x64\libpng.lib ..\Qub3d-libs\lib\msw\x64\Debug\v141\cinder.lib
cinder.lib(wrapper.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in mainMenu.o
cinder.lib(GlslProg.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in mainMenu.o
cinder.lib(GlslProg.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in mainMenu.
libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in mainMenu.o
libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in mainMenu.o
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
mainMenu.o : warning LNK4217: locally defined symbol __std_terminate imported in function "int `public: __cdecl std::shared_ptr<class cinder::app::Window>::~shared_ptr<class cinder::app::Window>(void)'::`1'::dtor$2" (?dtor$2#?0???1?$shared_ptr#VWindow#app#cinder###std##QEAA#XZ#4HA)
Qub3d_EngineApp.o : warning LNK4049: locally defined symbol __std_terminate imported
Qub3d_EngineApp.o : warning LNK4217: locally defined symbol _CxxThrowException imported in function "int `private: void __cdecl std::shared_ptr<class cinder::app::Renderer>::_Setp<class cinder::app::RendererGl>(class cinder::app::RendererGl *,struct shared_ptr<class cinder::app::Renderer>::integral_constant<bool,0>)'::`1'::catch$4" (?catch$4#?0???$_Setp#VRendererGl#app#cinder###?$shared_ptr#VRenderer#app#cinder###std##AEAAXPEAVRendererGl#app#cinder##U?$integral_constant#_N$0A##1##Z#4HA)
cinder.lib(TextureFormatParsers.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Unicode.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(RendererImplGlMsw.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Platform.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Signals.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(System.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Context.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Batch.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Log.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Exception.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Window.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Environment.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(CinderAssert.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(Shader.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(wrapper.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(RendererGl.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(AppBase.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(AppMsw.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
cinder.lib(AppMsw.obj) : error LNK2019: unresolved external symbol __imp_GetCursorPos referenced in function "public: virtual struct glm::tvec2<int,0> __cdecl cinder::app::AppMsw::getMousePos(void)const " (?getMousePos#AppMsw#app#cinder##UEBA?AU?$tvec2#H$0A##glm##XZ)
cinder.lib(AppMsw.obj) : error LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function "public: static void __cdecl cinder::app::AppMsw::initialize(class cinder::app::AppMsw::Settings *,class std::shared_ptr<class cinder::app::Renderer> const &,char const *)" (?initialize#AppMsw#app#cinder##SAXPEAVSettings#123#AEBV?$shared_ptr#VRenderer#app#cinder###std##PEBD#Z)
cinder.lib(ConstantConversions.obj) : error LNK2001: unresolved external symbol _calloc_dbg
cinder.lib(PlatformMsw.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(GeomIo.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(GlslProg.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(BufferObj.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(Vao.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(Fbo.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(Context.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(Log.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(Utilities.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(Texture.obj) : error LNK2001: unresolved external symbol _free_dbg
cinder.lib(ShaderPreprocessor.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(ConstantConversions.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(VboMesh.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(PlatformMsw.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(GeomIo.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(GlslProg.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(BufferObj.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Vao.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Fbo.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Context.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Log.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Utilities.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Texture.obj) : error LNK2001: unresolved external symbol _malloc_dbg
cinder.lib(Log.obj) : error LNK2019: unresolved external symbol __imp_CloseEventLog referenced in function "public: virtual __cdecl cinder::log::LoggerSystem::ImplEventLog::~ImplEventLog(void)" (??1ImplEventLog#LoggerSystem#log#cinder##UEAA#XZ)
cinder.lib(Log.obj) : error LNK2019: unresolved external symbol __imp_RegisterEventSourceW referenced in function "public: __cdecl cinder::log::LoggerSystem::ImplEventLog::ImplEventLog(void)" (??0ImplEventLog#LoggerSystem#log#cinder##QEAA#XZ)
cinder.lib(Log.obj) : error LNK2019: unresolved external symbol __imp_ReportEventW referenced in function "public: virtual void __cdecl cinder::log::LoggerSystem::ImplEventLog::write(struct cinder::log::Metadata const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?write#ImplEventLog#LoggerSystem#log#cinder##UEAAXAEBUMetadata#34#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
cinder.lib(RendererImplGlMsw.obj) : error LNK2019: unresolved external symbol __imp_ChoosePixelFormat referenced in function "bool __cdecl cinder::app::`anonymous namespace'::getWglFunctionPointers(struct HGLRC__ * (__cdecl**)(struct HDC__ *,struct HGLRC__ *,int const *),int (__cdecl**)(struct HDC__ *,int const *,float const *,unsigned int,int *,unsigned int *))" (?getWglFunctionPointers#?A0x83b54a9b#app#cinder##YA_NPEAP6APEAUHGLRC__##PEAUHDC__##PEAU4#PEBH#ZPEAP6AH02PEBMIPEAHPEAI#Z#Z)
cinder.lib(RendererImplGlMsw.obj) : error LNK2019: unresolved external symbol __imp_DescribePixelFormat referenced in function "bool __cdecl cinder::app::`anonymous namespace'::setPixelFormat(struct HDC__ *,struct cinder::app::RendererGl::Options const &)" (?setPixelFormat#?A0x83b54a9b#app#cinder##YA_NPEAUHDC__##AEBUOptions#RendererGl#23##Z)
cinder.lib(RendererImplGlMsw.obj) : error LNK2019: unresolved external symbol __imp_SetPixelFormat referenced in function "bool __cdecl cinder::app::`anonymous namespace'::getWglFunctionPointers(struct HGLRC__ * (__cdecl**)(struct HDC__ *,struct HGLRC__ *,int const *),int (__cdecl**)(struct HDC__ *,int const *,float const *,unsigned int,int *,unsigned int *))" (?getWglFunctionPointers#?A0x83b54a9b#app#cinder##YA_NPEAP6APEAUHGLRC__##PEAUHDC__##PEAU4#PEBH#ZPEAP6AH02PEBMIPEAHPEAI#Z#Z)
cinder.lib(RendererImplGlMsw.obj) : error LNK2019: unresolved external symbol __imp_SwapBuffers referenced in function "public: virtual void __cdecl cinder::app::RendererImplGlMsw::swapBuffers(void)const " (?swapBuffers#RendererImplGlMsw#app#cinder##UEBAXXZ)
cinder.lib(RendererImplGlMsw.obj) : error LNK2019: unresolved external symbol __imp_DefWindowProcW referenced in function "struct HWND__ * __cdecl cinder::app::`anonymous namespace'::createDummyWindow(void)" (?createDummyWindow#?A0x83b54a9b#app#cinder##YAPEAUHWND__##XZ)
cinder.lib(AppImplMsw.obj) : error LNK2001: unresolved external symbol __imp_DefWindowProcW
cinder.lib(RendererImplGlMsw.obj) : error LNK2019: unresolved external symbol __imp_RegisterClassW referenced in function "struct HWND__ * __cdecl cinder::app::`anonymous namespace'::createDummyWindow(void)" (?createDummyWindow#?A0x83b54a9b#app#cinder##YAPEAUHWND__##XZ)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_MapVirtualKeyW referenced in function "wchar_t __cdecl cinder::app::mapVirtualKey(unsigned __int64)" (?mapVirtualKey#app#cinder##YA_W_K#Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_SetCapture referenced in function "__int64 __cdecl cinder::app::WndProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WndProc#app#cinder##YA_JPEAUHWND__##I_K_J#Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_ReleaseCapture referenced in function "__int64 __cdecl cinder::app::WndProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WndProc#app#cinder##YA_JPEAUHWND__##I_K_J#Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_SetForegroundWindow referenced in function "public: __cdecl cinder::app::BlankingWindow::BlankingWindow(class std::shared_ptr<class cinder::Display>)" (??0BlankingWindow#app#cinder##QEAA#V?$shared_ptr#VDisplay#cinder###std###Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_BeginPaint referenced in function "__int64 __cdecl cinder::app::BlankingWndProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?BlankingWndProc#app#cinder##YA_JPEAUHWND__##I_K_J#Z)
cinder.lib(RendererImpl2dGdi.obj) : error LNK2001: unresolved external symbol __imp_BeginPaint
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_EndPaint referenced in function "__int64 __cdecl cinder::app::BlankingWndProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?BlankingWndProc#app#cinder##YA_JPEAUHWND__##I_K_J#Z)
cinder.lib(RendererImpl2dGdi.obj) : error LNK2001: unresolved external symbol __imp_EndPaint
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_InvalidateRect referenced in function "public: void __cdecl cinder::app::WindowImplMsw::setBorderless(bool)" (?setBorderless#WindowImplMsw#app#cinder##QEAAX_N#Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_RedrawWindow referenced in function "public: virtual void __cdecl cinder::app::WindowImplMsw::redraw(void)" (?redraw#WindowImplMsw#app#cinder##UEAAXXZ)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_SetWindowTextW referenced in function "public: virtual void __cdecl cinder::app::WindowImplMsw::setTitle(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?setTitle#WindowImplMsw#app#cinder##UEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_GetWindowTextW referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cinder::app::WindowImplMsw::getTitle(void)const " (?getTitle#WindowImplMsw#app#cinder##UEBA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_GetOpenFileNameW referenced in function "public: static class std::experimental::filesystem::v1::path __cdecl cinder::app::AppImplMsw::getOpenFilePath(class std::experimental::filesystem::v1::path const &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >)" (?getOpenFilePath#AppImplMsw#app#cinder##SA?AVpath#v1#filesystem#experimental#std##AEBV45678#V?$vector#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V?$allocator#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###2##8##Z)
cinder.lib(AppImplMsw.obj) : error LNK2019: unresolved external symbol __imp_GetSaveFileNameW referenced in function "public: static class std::experimental::filesystem::v1::path __cdecl cinder::app::AppImplMsw::getSaveFilePath(class std::experimental::filesystem::v1::path const &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >)" (?getSaveFilePath#AppImplMsw#app#cinder##SA?AVpath#v1#filesystem#experimental#std##AEBV45678#V?$vector#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V?$allocator#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###2##8##Z)
cinder.lib(ImageTargetFileWic.obj) : error LNK2001: unresolved external symbol __imp_CoCreateInstance
cinder.lib(ImageTargetFileWic.obj) : error LNK2019: unresolved external symbol __imp_VariantInit referenced in function "protected: __cdecl cinder::ImageTargetFileWic::ImageTargetFileWic(class std::shared_ptr<class cinder::DataTarget>,class std::shared_ptr<class cinder::ImageSource>,class cinder::ImageTarget::Options,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0ImageTargetFileWic#cinder##IEAA#V?$shared_ptr#VDataTarget#cinder###std##V?$shared_ptr#VImageSource#cinder###3#VOptions#ImageTarget#1#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##3##Z)
bin\Debug\Qub3d.exe : fatal error LNK1120: 93 unresolved externals
I've linked cinder.lib, libEGL.lib, libGLESv2.lib, and libpng.lib
I don't see any reason why this should not be working.
I'm trying to compile the zeromq sources and I have the following error:
I'm using Visual studio 2013 update 4 / windows 7 x64
First of all I compile the libsodium library satisfactorily.
Then I link the libsodium header files directory path to additional dependencies and libsodium.lib to additional library directories. I also specify the name of library in additional dependencies.
I try to compile it under win32 architecture and x64 architecture but I get the same errors.
I know that a __imp prefix is used as a bridge to the function that I want to use so if I linked the libraries appropiately why do I get this error?
Console log:
1>Creating library E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib and object E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp
1>ctx.obj : error LNK2019: unresolved external symbol __imp__randombytes_close referenced in function "public: __thiscall zmq::ctx_t::~ctx_t(void)" (??1ctx_t#zmq##QAE#XZ)
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__sodium_init referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t#zmq##QAE#ABUoptions_t#1##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__sodium_init
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_keypair referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t#zmq##QAE#ABUoptions_t#1##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>zmq_utils.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_beforenm referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome#curve_client_t#zmq##AAEHPBEI#Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_beforenm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box referenced in function "private: int __thiscall zmq::curve_client_t::produce_hello(class zmq::msg_t *)" (?produce_hello#curve_client_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome#curve_client_t#zmq##AAEHPBEI#Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::encode(class zmq::msg_t *)" (?encode#curve_client_t#zmq##UAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::decode(class zmq::msg_t *)" (?decode#curve_client_t#zmq##UAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__randombytes referenced in function "private: int __thiscall zmq::curve_client_t::produce_initiate(class zmq::msg_t *)" (?produce_initiate#curve_client_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__randombytes
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox referenced in function "private: int __thiscall zmq::curve_server_t::produce_welcome(class zmq::msg_t *)" (?produce_welcome#curve_server_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox_open referenced in function "private: int __thiscall zmq::curve_server_t::process_initiate(class zmq::msg_t *)" (?process_initiate#curve_server_t#zmq##AAEHPAVmsg_t#2##Z)
Thanks in advance.
You're probably compiling libsodium in a static way.
Try to compile it dinamically and link it again.
Such errors are also able to occur when you have a wrong set calling convention at your project.
I have been trying to communicate with my cassandra database with this demo code from Cassandra's cpp-driver. I am using Visual Studio Express 2013 I have been blocked with the following errors:
1>------ Build started: Project: Test_Boost, Configuration: Debug Win32 ------
1> main.cpp`
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl cql::cql_initialize(void)" (?cql_initialize#cql##YAXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: static class boost::shared_ptr<class cql::cql_builder_t> __cdecl cql::cql_cluster_t::builder(void)" (?builder#cql_cluster_t#cql##SA?AV?$shared_ptr#Vcql_builder_t#cql###boost##XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _sk_new_null referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _sk_free referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_cleanup_all_ex_data referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_num_locks referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_set_id_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CONF_modules_unload referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _EVP_cleanup referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _ERR_reason_error_string referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall boost::asio::error::detail::ssl_category::message(int)const " (?message#ssl_category#detail#error#asio#boost##UBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z)
1>main.obj : error LNK2019: unresolved external symbol _ERR_free_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _ERR_remove_state referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _ENGINE_cleanup referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol "public: class boost::shared_ptr<class cql::cql_cluster_t> __thiscall cql::cql_builder_t::build(void)" (?build#cql_builder_t#cql##QAE?AV?$shared_ptr#Vcql_cluster_t#cql###boost##XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: class cql::cql_builder_t & __thiscall cql::cql_builder_t::add_contact_point(class boost::asio::ip::address const &)" (?add_contact_point#cql_builder_t#cql##QAEAAV12#ABVaddress#ip#asio#boost###Z) referenced in function _main
1>D:\dev\CassandraData\VisualStudio\Test_Boost\Debug\Test_Boost.exe : fatal error LNK1120: 19 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am a complete newbie in cpp and I would appreciate any help!
Thank you!
This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 6 years ago.
I'm a beginner C++ programmer. I'm trying Google Test in Visual Studio 2012 and have problem starting a demo source code I got from internet.
int CompareChar(char* ch1, char* ch2)
{
if (ch1 == NULL || ch2 == NULL)
return 88;
return strcmp(ch1, ch2);
}
TEST(CompareCharTest, InputChar) {
// Expect equal
EXPECT_EQ(0, CompareChar("hello", "hello"));
// Expect not equal
EXPECT_NE(0, CompareChar("hello", "world"));
}
TEST(SampleClassTest, InputNumber) {
SampleClass sample(10);
EXPECT_EQ(1, sample.CompareValue(10)); // Expect equal
}
int _tmain(int argc, _TCHAR* argv[])
{
::testing::InitGoogleTest(&argc, argv);
int i = RUN_ALL_TESTS();
getchar();
return i;
}
So, when I try to build the code, it generates dozens of linking errors which I couldn't sort out. I tried to include .lib files in the property of the project but couldn't solve it.
The error:
>1>------ Build started: Project: GTestSample, Configuration: Release Win32 ------
>1> stdafx.cpp
1> GTestSample.cpp
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall testing::Message::GetString(void)const " (?GetString#Message#testing##QBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::Message::Message(void)" (??0Message#testing##QAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: static class testing::UnitTest * __cdecl testing::UnitTest::GetInstance(void)" (?GetInstance#UnitTest#testing##SAPAV12#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: int __thiscall testing::UnitTest::Run(void)" (?Run#UnitTest#testing##QAEHXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: __thiscall testing::Test::Test(void)" (??0Test#testing##IAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall testing::Test::~Test(void)" (??1Test#testing##UAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::TestInfo * __cdecl testing::internal::MakeAndRegisterTestInfo(char const *,char const *,char const *,char const *,void const *,void (__cdecl*)(void),void (__cdecl*)(void),class testing::internal::TestFactoryBase *)" (?MakeAndRegisterTestInfo#internal#testing##YAPAVTestInfo#2#PBD000PBXP6AXXZ2PAVTestFactoryBase#12##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "void const * __cdecl testing::internal::GetTestTypeId(void)" (?GetTestTypeId#internal#testing##YAPBXXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: void __thiscall testing::internal::AssertHelper::operator=(class testing::Message const &)const " (??4AssertHelper#internal#testing##QBEXABVMessage#2##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::internal::AssertHelper::AssertHelper(enum testing::TestPartResult::Type,char const *,int,char const *)" (??0AssertHelper#internal#testing##QAE#W4Type#TestPartResult#2#PBDH1#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::internal::AssertHelper::~AssertHelper(void)" (??1AssertHelper#internal#testing##QAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "void __cdecl testing::InitGoogleTest(int *,wchar_t * *)" (?InitGoogleTest#testing##YAXPAHPAPA_W#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "bool __cdecl testing::internal::IsTrue(bool)" (?IsTrue#internal#testing##YA_N_N#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::AssertionSuccess(void)" (?AssertionSuccess#testing##YA?AVAssertionResult#1#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::AssertionResult::AssertionResult(class testing::AssertionResult const &)" (??0AssertionResult#testing##QAE#ABV01##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::AssertionFailure(void)" (?AssertionFailure#testing##YA?AVAssertionResult#1#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::internal::EqFailure(char const *,char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (?EqFailure#internal#testing##YA?AVAssertionResult#2#PBD0ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##1_N#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall testing::Test::SetUp(void)" (?SetUp#Test#testing##MAEXXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall testing::Test::TearDown(void)" (?TearDown#Test#testing##MAEXXZ)
1>D:\VisualStudioProj\GTestSample\Release\GTestSample.exe : fatal error LNK1120: 19 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I had the same issue. Make sure that in your test project's properties, you go into Project->Linker->General settings and add the msvc/Release directory to Additional Directories. Furthermore, under Linker->Input, add gtest.lib into Additional Dependencies. Then you should be good to go!
I know this post is old, but it could still help anyone out. A quick Google search for "LNK2019 unresolved external symbol "bool __cdecl testing::internal::IsTrue ..." as stated above gives this stackoverflow and several sites with the same answers.
For those that tried Oleg Vaskevich solution or similar and failed, try this. If you are using Visual Studio, C/C++ -> General -> Additional Include Directories and make sure that the gtest is included. Secondly, (which will likely be your answer), copy the gtest-all.cc in the gtest/scr/ folder and paste in your project directory (wherever your .cpp/.h files are saved), then go back to Visual Studio and include it in your project. You will have to unhide files/folders to view it. 'Include to project'.
I know that copying and pasting this isn't ideal for every project, but the point is to at least get it working and making sure this is the true problem and not something else.
Because I never complied my version, I never had any lib files to begin with.