我正在尝试使用 C 语言为 Web 服务创建客户端。我使用 wsdl2h 和soapcpp2 生成了 C 文件。在 netbeans 中,我将生成的文件和 gSOAP 包含目录添加到项目的包含目录中。
我的主文件如下所示:
#include <stdio.h>
#include <stdlib.h>
#include <soapH.h>
#include <webserviceSoap12.nsmap>
int main(int argc, char** argv) {
struct soap *soap1 = soap_new();
struct _ns1__getAllCustomer *quote;
struct _ns1__getAllCustomerResponse *quote2;
if (soap_call___ns2__getAllCustomer(soap1, NULL, NULL, quote, quote2) == SOAP_OK)
printf("asd\n");
else // an error occurred
soap_print_fault(soap1, stderr); // display the SOAP fault on the stderr stream
return (EXIT_SUCCESS);
}
我从 gSOAP 网站的入门部分复制了大部分内容。
当我尝试编译时出现以下错误:
build/Debug/MinGW-Windows/main.o: In function `main':
\NetBeansProjects\WebServiceClient/main.c:19: undefined reference to `soap_new_LIBRARY_VERSION_REQUIRED_20808'
\NetBeansProjects\WebServiceClient/main.c:22: undefined reference to `soap_call___ns2__getAllCustomer'
\NetBeansProjects\WebServiceClient/main.c:25: undefined reference to `soap_print_fault'
如果我将“soapC.c”“soapClient.c”“soapClientLib.c”文件添加到项目中,我会得到一堆更多未定义的参考。
我究竟做错了什么?我在 Win7 上使用 Netbeans ide 和 MinGW 编译器。我还需要哪些其他库或者我应该包含哪些其他文件?
我设法通过将文件“soapC.c”“soapClient.c”“stdsoap.c”添加到项目文件和项目属性 - 包含目录中添加由soapcpp2和gSOAP工具包的gsoap目录生成的文件来解决该问题
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)