如何在windows编译gloox

如何在windows编译gloox

1. Enviroment
 "gloox - 0.9.9.5" + "Windows Server 2008" + "VC++ 2008"

2. config.h.win
HAVE_WINTLS
HAVE_WINDNS_H
HAVE_SETSOCKOPT

默认编译的时候出错:
dns.obj : error LNK2019: unresolved external symbol _DnsFree@8 referenced in function "public: static class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,int> > > __cdecl gloox::DNS::resolve(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class gloox::LogSink const &)" ( ?resolve@DNS@gloox@@SA?AV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HU?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@std@@@2@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@00ABVLogSink@2@@Z)
dns.obj : error LNK2019: unresolved external symbol _DnsQuery_A@24 referenced in function "public: static class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,int> > > __cdecl gloox::DNS::resolve(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class gloox::LogSink const &)" ( ?resolve@DNS@gloox@@SA?AV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HU?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@std@@@2@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@00ABVLogSink@2@@Z)
tlsschannel.obj : error LNK2019: unresolved external symbol _EncryptMessage@16 referenced in function "public: virtual bool __thiscall gloox::SChannel::encrypt(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ( ?encrypt@SChannel@gloox@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
tlsschannel.obj : error LNK2019: unresolved external symbol _DecryptMessage@16 referenced in function "public: virtual int __thiscall gloox::SChannel::decrypt(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ( ?decrypt@SChannel@gloox@@UAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
tlsschannel.obj : error LNK2019: unresolved external symbol __imp__FreeCredentialsHandle@4 referenced in function "public: virtual void __thiscall gloox::SChannel::cleanup(void)" ( ?cleanup@SChannel@gloox@@UAEXXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol __imp__DeleteSecurityContext@4 referenced in function "public: virtual void __thiscall gloox::SChannel::cleanup(void)" ( ?cleanup@SChannel@gloox@@UAEXXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol _FreeContextBuffer@4 referenced in function "public: virtual bool __thiscall gloox::SChannel::handshake(void)" ( ?handshake@SChannel@gloox@@UAE_NXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol _InitializeSecurityContextA@48 referenced in function "public: virtual bool __thiscall gloox::SChannel::handshake(void)" ( ?handshake@SChannel@gloox@@UAE_NXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol _AcquireCredentialsHandleA@36 referenced in function "public: virtual bool __thiscall gloox::SChannel::handshake(void)" ( ?handshake@SChannel@gloox@@UAE_NXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol _QueryContextAttributesA@12 referenced in function "private: void __thiscall gloox::SChannel::setSizes(void)" ( ?setSizes@SChannel@gloox@@AAEXXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol __imp__CertFreeCertificateChain@4 referenced in function "private: void __thiscall gloox::SChannel::validateCert(void)" ( ?validateCert@SChannel@gloox@@AAEXXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol __imp__CertVerifyCertificateChainPolicy@16 referenced in function "private: void __thiscall gloox::SChannel::validateCert(void)" ( ?validateCert@SChannel@gloox@@AAEXXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol __imp__CertGetCertificateChain@32 referenced in function "private: void __thiscall gloox::SChannel::validateCert(void)" ( ?validateCert@SChannel@gloox@@AAEXXZ)
tlsschannel.obj : error LNK2019: unresolved external symbol __imp__CertNameToStrA@20 referenced in function "private: void __thiscall gloox::SChannel::certData(void)" ( ?certData@SChannel@gloox@@AAEXXZ)

3. 加入需要的lib, 编译成功
ws2_32.lib Dnsapi.lib Secur32.lib Crypt32.lib

你可能感兴趣的:(如何在windows编译gloox)