Link VS2017 的 NanoMsg 错误
Link Errors for NanoMsg with VS2017
我正在尝试在 windows 盒子上构建下一代 nanomsg (https://github.com/nanomsg/nng)。我正在使用 VS2017。 CMAKE 就像一个魅力。
我收到 link 错误。我已验证 nng.lib 文件位于:
D:\Source\LinkWareMessageBus\nng\lib
Dumbin.exe 表示符号都已就位(并且没有编译或 link 错误)
Linker/General/Additional 库目录是:D:\Source\LinkWareMessageBus\nng\lib
.h 文件读取正常。但我收到以下 link 错误:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp__nng_setopt referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_listen referenced in function "int __cdecl server(char const *)" (?server@@YAHPBD@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_dial referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_strerror referenced in function "void __cdecl fatal(char const *,int)" (?fatal@@YAXPBDH@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_send referenced in function "int __cdecl server(char const *)" (?server@@YAHPBD@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_recv referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_free referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_pub0_open referenced in function "int __cdecl server(char const *)" (?server@@YAHPBD@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_sub0_open referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
这些是我的 VS2017 设置(x64 .lib 和 x64 项目)。
我还附上 nng.lib 文件中符号的 dumpbin。
我怀疑 VS2017 没有正确配置以找到 .lib(除了将路径添加到 linker/additional 库)我应该怎么做?
更新
我不再说这个简单了。但我确实走得更远,也许你能帮助我越过终点线。即使我告诉 VS2017 在哪里可以找到 nng.lib(路径和名称)。我还尝试将它与 kernel32.lib user32.lib 和其他强制性库一起放入。
好的。我现在不再收到有关 nng_xxxx 符号的错误。相反,它现在抱怨 nng.lib 正在寻找的符号。
见下文:
这是 VS2017 中 link 的详细日志的 link:
verbose link log
```
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp_WSARecvFrom referenced in function nni_win_udp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSACleanup referenced in function nni_plat_fini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_thread.c.obj) 1
Error LNK2001 unresolved external symbol __imp_WSACleanup LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_WSACleanup LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_bind referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_bind LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_bind LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_closesocket referenced in function nni_plat_tcp_ep_init LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_closesocket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_closesocket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_getsockname referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_getsockname LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_getsockname LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_listen referenced in function nni_win_tcp_listen LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_listen LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_setsockopt referenced in function nni_plat_tcp_pipe_set_nodelay LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_setsockopt LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_setsockopt LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_socket referenced in function nni_plat_tcp_ep_init LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_socket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_socket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSAStartup referenced in function nni_win_tcp_sysinit LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_WSAStartup LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSAGetLastError referenced in function nni_plat_tcp_pipe_set_nodelay LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSAIoctl referenced in function nni_plat_tcp_ep_init LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSARecv referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSASend referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol inet_ntop referenced in function nni_plat_tcp_ntop LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSASendTo referenced in function nni_win_udp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_htons referenced in function resolv_ip LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_resolv.c.obj) 1
Error LNK2019 unresolved external symbol __imp_getaddrinfo referenced in function resolv_task LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_resolv.c.obj) 1
Error LNK2019 unresolved external symbol __imp_freeaddrinfo referenced in function resolv_task LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_resolv.c.obj) 1
Error LNK2019 unresolved external symbol __imp_accept referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_connect referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_ioctlsocket referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_htonl referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_recv referenced in function nni_plat_pipe_clear LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_send referenced in function nni_plat_pipe_raise LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK1120 24 unresolved externals LinkWareMessageBus D:\Source\LinkWareMessageBus\x64\Debug\LinkWareMessageBus.exe 1
```
您要查找的符号(基于更新)是在 ws2_32.lib 中找到的 Winsock 函数。
我正在尝试在 windows 盒子上构建下一代 nanomsg (https://github.com/nanomsg/nng)。我正在使用 VS2017。 CMAKE 就像一个魅力。
我收到 link 错误。我已验证 nng.lib 文件位于:
D:\Source\LinkWareMessageBus\nng\lib
Dumbin.exe 表示符号都已就位(并且没有编译或 link 错误)
Linker/General/Additional 库目录是:D:\Source\LinkWareMessageBus\nng\lib
.h 文件读取正常。但我收到以下 link 错误:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp__nng_setopt referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_listen referenced in function "int __cdecl server(char const *)" (?server@@YAHPBD@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_dial referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_strerror referenced in function "void __cdecl fatal(char const *,int)" (?fatal@@YAXPBDH@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_send referenced in function "int __cdecl server(char const *)" (?server@@YAHPBD@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_recv referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_free referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_pub0_open referenced in function "int __cdecl server(char const *)" (?server@@YAHPBD@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
Error LNK2019 unresolved external symbol __imp__nng_sub0_open referenced in function "int __cdecl client(char const *,char const *)" (?client@@YAHPBD0@Z) LinkWareMessageBus D:\Source\LinkWareMessageBus\LinkWareMessageBus.obj 1
这些是我的 VS2017 设置(x64 .lib 和 x64 项目)。
我还附上 nng.lib 文件中符号的 dumpbin。
我怀疑 VS2017 没有正确配置以找到 .lib(除了将路径添加到 linker/additional 库)我应该怎么做?
更新
我不再说这个简单了。但我确实走得更远,也许你能帮助我越过终点线。即使我告诉 VS2017 在哪里可以找到 nng.lib(路径和名称)。我还尝试将它与 kernel32.lib user32.lib 和其他强制性库一起放入。
好的。我现在不再收到有关 nng_xxxx 符号的错误。相反,它现在抱怨 nng.lib 正在寻找的符号。
见下文:
这是 VS2017 中 link 的详细日志的 link: verbose link log
```
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp_WSARecvFrom referenced in function nni_win_udp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSACleanup referenced in function nni_plat_fini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_thread.c.obj) 1
Error LNK2001 unresolved external symbol __imp_WSACleanup LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_WSACleanup LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_bind referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_bind LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_bind LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_closesocket referenced in function nni_plat_tcp_ep_init LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_closesocket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_closesocket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_getsockname referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_getsockname LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_getsockname LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_listen referenced in function nni_win_tcp_listen LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_listen LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_setsockopt referenced in function nni_plat_tcp_pipe_set_nodelay LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_setsockopt LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_setsockopt LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_socket referenced in function nni_plat_tcp_ep_init LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_socket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_socket LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSAStartup referenced in function nni_win_tcp_sysinit LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2001 unresolved external symbol __imp_WSAStartup LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSAGetLastError referenced in function nni_plat_tcp_pipe_set_nodelay LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSAIoctl referenced in function nni_plat_tcp_ep_init LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSARecv referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSASend referenced in function nni_win_tcp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol inet_ntop referenced in function nni_plat_tcp_ntop LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_tcp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_WSASendTo referenced in function nni_win_udp_sysfini LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_udp.c.obj) 1
Error LNK2019 unresolved external symbol __imp_htons referenced in function resolv_ip LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_resolv.c.obj) 1
Error LNK2019 unresolved external symbol __imp_getaddrinfo referenced in function resolv_task LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_resolv.c.obj) 1
Error LNK2019 unresolved external symbol __imp_freeaddrinfo referenced in function resolv_task LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_resolv.c.obj) 1
Error LNK2019 unresolved external symbol __imp_accept referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_connect referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_ioctlsocket referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_htonl referenced in function nni_plat_pipe_open LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_recv referenced in function nni_plat_pipe_clear LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK2019 unresolved external symbol __imp_send referenced in function nni_plat_pipe_raise LinkWareMessageBus D:\Source\LinkWareMessageBus\nng.lib(win_pipe.c.obj) 1
Error LNK1120 24 unresolved externals LinkWareMessageBus D:\Source\LinkWareMessageBus\x64\Debug\LinkWareMessageBus.exe 1
```
您要查找的符号(基于更新)是在 ws2_32.lib 中找到的 Winsock 函数。