我正在使用gsoap来调用wcf webservice。我的要求是说我必须使用ssl协议来保护通信。我读了an article作为我对ssl配置的参考。
但是在编译中我得到以下错误:
错误1错误LNK2019:未解析的外部符号_soap_ssl_init在函数&#34中引用; public:int __thiscall LogServicesFacade :: SendFileToServer(char const *)" (?SendFileToServer @ LogServicesFacade @@ QAEHPBD @ Z)E:\ Path \ To \ My \ Solution.Project \ LogServicesFacade.obj Solution.Project
这是我的代码:
_ns1__StoreEventFileResponse response;
_ns1__StoreEventFile input;
struct soap *soap = soap_new();
/*if (!sslInitiated)
{*/
soap_ssl_init();
//if (soap_ssl_client_context(soap, SOAP_SSL_DEFAULT, NULL, NULL,
//"C:\\Path\\To\\Certs\\File\\cacerts.pem", NULL, NULL))
//{
soap_print_fault(soap, stderr);
//}
//}
为了简单起见,我评论了另一个ssl函数来减少错误。
更新1
值得一提的是我使用VS 2013.所以我使用Visual C ++作为我的编译器。我也看到了gSOAP ssl document。作者说我必须向编译器添加Option DWITH_OPENSSL
。我如何将其添加到VC编译器?
答案 0 :(得分:0)
正如code project article所述,我使用以下步骤缓解了错误:
右键单击项目,然后从右键单击菜单中选择“属性”。在配置属性,C / C ++和常规下,添加 包括gSOAP和Open SSL的路径。单击“应用”
在配置属性,C / C ++和预处理器下,添加“WITH_OPENSSL”(在gSOAP中启用SSL)和“DEBUG”(启用 记录)到预处理器定义列表。单击“应用”。
在Configuration Properties,Linker和General下,添加Open SSL二进制目录的路径,其中编译的lib文件 驻留,到其他图书馆目录。单击“应用”。
- 在Configuration Properties,Linker和Input下,将“libeay32.lib”和“ssleay32.lib”添加到Additional Dependencies。这些
是开放SSL库。单击“应用”。