最近使用gSOAP XML/RPC + C代码编写我的测试程序,编译时出现“soapStub.h: error: redefinition of parameter ‘soap’”。
[root@localhost src]# make iclient
gcc -o iclient iclient.c wsi2c.h soapClient.c soapC.c base.c base.h -lgsoap
In file included from soapH.h:13:0,
from iclient.c:12:
soapStub.h:255:132: error: redefinition of parameter ‘soap’
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns__myset(struct soap *soap,const char *soap_endpoint,const char *soap_action,struct soap *soap,char *bus,char *devaddr,int reg,int data,int *result);
根据提示,soap_call_ns__myset(struct soap *soap,int *result),注意到了soap_call_ns__myset函数的参数出现了两个struct soap*soap,因此报此错。
解决方法是将iws.h文件直接删除struct soap *soap即可。
int ns__myset(struct soap *soap,char *bus,int *result);
如果服务器端需要使用struct soap *soap结构体指针,那就在服务器端程序中添加即可。例如:
1、iws.h
int ns__myset(char *bus,int *result);
2、iserver.c
int ns__myset(struct soap *soap,char *bus,int *result);
原文链接:https://www.f2er.com/xml/294264.html