我正在尝试在Windows框上构建nanomsg下一代(https://github.com/nanomsg/nng)。我正在使用VS2017。 CMAKE就像一种魅力。
我收到链接错误。我已验证nng.lib文件位于:
D:\ Source \ LinkWareMessageBus \ nng \ lib
Dumbin.exe表示符号都已放置到位(并且没有编译或链接错误)
链接器/常规/附加库目录为:D:\ Source \ LinkWareMessageBus \ nng \ lib
.h文件可以正常读取。但是我收到以下链接错误:
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文件中附加了符号的转储。
我怀疑VS2017没有正确配置以找到.lib(除了将路径添加到链接器/附加库之外)我应该怎么办?
我不再说这很简单。但是我确实走得更远,也许您可以帮助克服终点线。即使我告诉VS2017在哪里可以找到nng.lib(路径和名称)。我还尝试将它与kernel32.lib user32.lib和其他必需的库一起放入。
好。我现在不再遇到有关nng_xxxx符号的错误。而是现在它正在抱怨nng.lib正在寻找的符号。
参见下文:
这是VS2017中的链接的详细日志的链接: 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
```
答案 0 :(得分:0)
您要查找的符号(基于更新)是在ws2_32.lib中找到的Winsock函数。