gpt4 book ai didi

c - 编译 gSOAP 客户端时 undefined reference

转载 作者:太空宇宙 更新时间:2023-11-03 23:33:04 25 4
gpt4 key购买 nike

我正在尝试用 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”文件添加到项目中,我会得到更多 undefined reference 。我究竟做错了什么?我在 Win7 上使用 Netbeans ide 和 MinGW 编译器。我还需要哪些其他库或应该包括哪些其他文件?

最佳答案

我设法通过将文件“soapC.c”、“soapClient.c”、“stdsoap.c”添加到项目文件和项目属性中来解决问题 - 包括添加由 soapcpp2 和 gSOAP 工具包生成的文件的目录gsoap目录

关于c - 编译 gSOAP 客户端时 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10765446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com