我需要在多线程(运行时)中编译我的程序,我已经安装了用于静态模式的poco库和使用vcpkg的dll,并且我已经添加了:
<PropertyGroup Label="Globals">
...
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>对于我在mt模式下编译的项目,在mt dll中编译是没有问题的,但是当我想要在mt模式下编译它时,我会有这样的错误:
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上:
#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添加到其他依赖项中,但我遇到了新的错误,如未解析的外部符号……,为什么会发生这种情况?
发布于 2020-11-20 16:29:20
我终于想明白了,如何解决这个问题,3天后,我们需要将crypt32.lib和ws2_32.lib添加到链接器/附加依赖项中。我希望这对处于类似情况的人有所帮助:)
https://stackoverflow.com/questions/64925899
复制相似问题