简体   繁体   中英

poco library, static linking (MT)

I need to compile my program in Multi thread( run time ), and i've installed poco library for static mode and dll using vcpkg, and i've already added :

<PropertyGroup Label="Globals">
 ...
 <VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
 <VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>

to my project for compiling in mt mode, in mt dll there is no problem for compiling, but when I want to compile it in mt mode, I have this errors :

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
...

it seems the problem is Net headers and 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"

I also tried to add ws2_32.lib and iphlpapi.lib to additional dependencies, but i have new errors like unresolved external symbol... , why is that happening?

I finally figured out, How to solve this problem, after 3 days, we need to add crypt32.lib and ws2_32.lib to linker / additional dependencies. I hope this helps someone in a similar circumstance :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM