问题描述
我按照
由于 27 个未解析的外部变量,我的项目无法在 Visul Studio 2019 中构建...
1>grpc.lib(iomgr_windows.cc.obj) :错误 LNK2019:未解析的外部符号 __imp_WSAStartup 在函数void __cdecl winsock_init(void)"中引用(?winsock_init@@YAXXZ)1>grpc.lib(iomgr_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSACleanup 在函数void __cdecl winsock_shutdown(void)"中引用(?winsock_shutdown@@YAXXZ)1>grpc.lib(socket_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_bind 在函数void __cdecl probe_ipv6_once(void)"中引用(?probe_ipv6_once@@YAXXZ)1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_bind1>grpc.lib(tcp_client_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_bind1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_bind1>grpc.lib(socket_windows.cc.obj):错误LNK2019:函数void __cdecl grpc_winsocket_shutdown(struct grpc_winsocket *)"中引用的未解析的外部符号__imp_closesocket(?grpc_winsocket_shutdown@@YAXPEAUgrpc_winsocket@@@Z)1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_closesocket1>grpc.lib(tcp_client_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_closesocket1>address_sorting.lib(address_sorting_windows.c.obj):错误LNK2001:未解析的外部符号__imp_closesocket1>grpc.lib(socket_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_socket 在函数void __cdecl probe_ipv6_once(void)"中引用(?probe_ipv6_once@@YAXXZ)1>address_sorting.lib(address_sorting_windows.c.obj):错误LNK2001:无法解析的外部符号__imp_socket1>grpc.lib(resolve_address_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAGetLastError1>grpc.lib(tcp_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAGetLastError1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_WSAGetLastError1>grpc.lib(socket_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_WSAGetLastError1>grpc.lib(iocp_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAGetLastError1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAGetLastError1>grpc.lib(tcp_client_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_WSAGetLastError1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_WSAIoctl1>grpc.lib(socket_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_WSAIoctl1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAIoctl1>grpc.lib(tcp_client_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAIoctl1>grpc.lib(tcp_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAIoctl1>grpc.lib(socket_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSASocketA 在函数void __cdecl grpc_wsa_socket_flags_init(void)"中引用(?grpc_wsa_socket_flags_init@@YAXXZ)1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSASocketA1>grpc.lib(tcp_client_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSASocketA1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2001:无法解析的外部符号 __imp_WSASocketA1>grpc.lib(iocp_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSAGetOverlappedResult 在函数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):错误 LNK2001:未解析的外部符号 __imp_WSAGetOverlappedResult1>grpc.lib(tcp_client_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAGetOverlappedResult1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSAGetOverlappedResult1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_getpeername 在函数void __cdecl on_accept(void *,struct grpc_error *)"中引用(?on_accept@@YAXPEAXPEAUgrpc_error@@@Z)1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_getsockname 在函数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):错误 LNK2001:未解析的外部符号 __imp_getsockname1>address_sorting.lib(address_sorting_windows.c.obj):错误LNK2001:无法解析的外部符号__imp_getsockname1>grpc.lib(tcp_server_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_listen 在函数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):错误 LNK2019:未解析的外部符号 __imp_setsockopt 在函数void __cdecl on_accept(void *,struct grpc_error *)"中引用(?on_accept@@YAXPEAXPEAUgrpc_error@@@Z)1>grpc.lib(tcp_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_setsockopt1>grpc.lib(resolve_address_windows.cc.obj):错误LNK2019:函数struct grpc_error * __cdecl windows_blocking_resolve_address(char const *,char const *,struct grpc_resolved_addresses)"中引用的未解析的外部符号__imp_getaddrinfo * *(?windows_blocking_resolve_address@@YAPEAUgrpc_error@@PEBD0PEAPEAUgrpc_resolved_addresses@@@Z)1>grpc.lib(resolve_address_windows.cc.obj):错误LNK2019:函数struct grpc_error * __cdecl windows_blocking_resolve_address(char const *,char const *,struct grpc_resolved_addresses)"中引用的未解析的外部符号__imp_freeaddrinfo * *(?windows_blocking_resolve_address@@YAPEAUgrpc_error@@PEBD0PEAPEAUgrpc_resolved_addresses@@@Z)1>grpc.lib(tcp_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSARecv 在函数void __cdecl on_read(void *,struct grpc_error *)"中引用(?on_read@@YAXPEAXPEAUgrpc_error@@@Z)1>grpc.lib(tcp_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSASend 在函数void __cdecl on_write(void *,struct grpc_error *)"中引用(?on_write@@YAXPEAXPEAUgrpc_error@@@Z)1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2001:未解析的外部符号 __imp_WSASend1>grpc.lib(socket_utils_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_htonl 在函数unsigned int __cdecl grpc_htonl(unsigned int)"中引用(?grpc_htonl@@YAII@Z)1>address_sorting.lib(address_sorting.c.obj):错误 LNK2001:未解析的外部符号 __imp_htonl1>grpc.lib(socket_utils_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_htons 在函数unsigned short __cdecl grpc_htons(unsigned short)"中引用(?grpc_htons@@YAGG@Z)1>grpc.lib(grpc_ares_wrapper.cc.obj):错误 LNK2001:未解析的外部符号 __imp_htons1>grpc.lib(parse_address.cc.obj):错误 LNK2001:未解析的外部符号 __imp_htons1>grpc.lib(socket_utils_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_ntohl 在函数unsigned int __cdecl grpc_ntohl(unsigned int)"中引用(?grpc_ntohl@@YAII@Z)1>grpc.lib(socket_utils_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_ntohs 在函数unsigned short __cdecl grpc_ntohs(unsigned short)"中引用(?grpc_ntohs@@YAGG@Z)1>grpc.lib(grpc_ares_wrapper.cc.obj):错误 LNK2001:未解析的外部符号 __imp_ntohs1>grpc.lib(socket_utils_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_inet_pton 在函数int __cdecl grpc_inet_pton(int,char const *,void *)"中引用(?grpc_inet_pton@@YAHHPEBDPEAX@Z)1>grpc.lib(socket_utils_windows.cc.obj):错误 LNK2019:函数char const * __cdecl grpc_inet_ntop(int,void const *,char *,unsigned __int64)"中引用的未解析的外部符号 inet_ntop(?grpc_inet_ntop@@YAPEBDHPEBXPEAD_K@Z)1>grpc.lib(ssl_transport_security.cc.obj):错误 LNK2001:未解析的外部符号 inet_ntop1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSASetLastError 在函数public: __cdecl grpc_core::WSAErrorContext::~WSAErrorContext(void)"中引用(??1WSAErrorContext@grpc_core@@QEAA@XZ)1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSAConnect 引用在函数public: int __cdecl grpc_core::GrpcPolledFdWindows::ConnectUDP(class grpc_core::WSAErrorContext *, const)"(?ConnectUDP@GrpcPolledFdWindows@grpc_core@@QEAAHPEAVWSAErrorContext@2@PEBUsockaddr@@H@Z)1>grpc.lib(grpc_ares_ev_driver_windows.cc.obj):错误 LNK2019:未解析的外部符号 __imp_WSARecvFrom 在函数public: void __cdecl grpc_core::GrpcPolledFdWindows::ContinueRegisterForOnReadableLocked"中引用(?ContinueRegisterForOnReadableLocked@GrpcPolledFdWindows@grpc_core@@QEAAXXZ)1>address_sorting.lib(address_sorting_windows.c.obj):错误LNK2019:函数address_sorting_create_source_addr_factory_for_current_platform中引用的未解析的外部符号__imp_connect
我在调试和 x64 配置中构建.
我错过了什么?我认为 vcpkg
会让生活更轻松吗?
在 Windows 上为 VisualC++ 链接 gRPC 的已接受答案的第二部分 完全解决了我的问题.
我将 #pragma comment(lib, "Ws2_32.lib")
添加到我的 cpp 文件中,问题就解决了.
它也可以像这样修复(我从 Unresolved external符号 LNK2019):
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):
这篇关于尽管启用了 AutoLink (vcpkg),但 VisualStudio for grpc 中的链接器仍然错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!