首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >poco库,静态链接(MT)

poco库,静态链接(MT)
EN

Stack Overflow用户
提问于 2020-11-20 16:11:21
回答 1查看 82关注 0票数 0

我需要在多线程(运行时)中编译我的程序,我已经安装了用于静态模式的poco库和使用vcpkg的dll,并且我已经添加了:

代码语言:javascript
复制
<PropertyGroup Label="Globals">
 ...
 <VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
 <VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>

对于我在mt模式下编译的项目,在mt dll中编译是没有问题的,但是当我想要在mt模式下编译它时,我会有这样的错误:

代码语言:javascript
复制
1>PocoNetmt.lib(Net.obj) : error LNK2001: unresolved external symbol __imp_WSAStartup
1>libcrypto.lib(b_sock.obj) : error LNK2001: unresolved external symbol __imp_WSAStartup
1>PocoNetmt.lib(Net.obj) : error LNK2001: unresolved external symbol __imp_WSACleanup
1>libcrypto.lib(b_sock.obj) : error LNK2001: unresolved external symbol __imp_WSACleanup
1>PocoNetmt.lib(SocketAddress.obj) : error LNK2001: unresolved external symbol __imp_htons
1>PocoNetmt.lib(SocketAddress.obj) : error LNK2001: unresolved external symbol __imp_ntohs
1>PocoNetmt.lib(SocketAddressImpl.obj) : error LNK2001: unresolved external symbol __imp_ntohs
1>libcrypto.lib(b_sock.obj) : error LNK2001: unresolved external symbol __imp_ntohs
1>libcrypto.lib(b_addr.obj) : error LNK2001: unresolved external symbol __imp_ntohs
1>PocoNetmt.lib(SocketAddress.obj) : error LNK2001: unresolved external symbol __imp_getservbyname
1>PocoNetmt.lib(DNS.obj) : error LNK2001: unresolved external symbol __imp_gethostname
...

似乎问题出在Net headers和my headers上:

代码语言:javascript
复制
#include "Poco/Net/MailMessage.h"
#include "Poco/Net/MailRecipient.h"
#include "Poco/Net/SMTPClientSession.h"
#include "Poco/Net/NetException.h"
#include "Poco/Net/SecureSMTPClientSession.h"
#include "Poco/Net/InvalidCertificateHandler.h"
#include "Poco/Net/AcceptCertificateHandler.h"
#include "Poco/Net/SSLManager.h"
#include "Poco/Net/SecureStreamSocket.h"
#include "Poco/Net/MailRecipient.h"

我还试图将ws2_32.lib和iphlpapi.lib添加到其他依赖项中,但我遇到了新的错误,如未解析的外部符号……,为什么会发生这种情况?

EN

Stack Overflow用户

回答已采纳

发布于 2020-11-20 16:29:20

我终于想明白了,如何解决这个问题,3天后,我们需要将crypt32.lib和ws2_32.lib添加到链接器/附加依赖项中。我希望这对处于类似情况的人有所帮助:)

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64925899

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档