我下载了gsoap 2.8.14,使用以下命令进行配置和安装:
./configure --disable-ssl --enable-samples --enable-debug
make
make install
我试图编译gsoap示例“hello”。所以我从样本中获取了wsdl文件并执行了以下操作:
wsdl2h -s -o hello.h h.wsdl
soapcpp2 hello.h
我将生成的文件复制到一个新的eclipse c ++项目中,并排除了soapClientLib.cpp和soapServerLib.cpp,因为我收到的错误如
然后我创建了一个helloserver.cpp,这里是内容:.....的多重定义。
#include "soapH.h"
#include "Service.nsmap"
int main()
{
return soap_serve(soap_new);
}
int __ns1__hello(struct soap *soap, char* helloReq, char* &helloResponse)
{
return SOAP_OK;
}
当我在eclipse中构建时,我收到错误:
...soapServer.cpp:77 undefined reference to __ns1__hello(soap*,_ns2_hello*, _ns__helloResponse*)
当我追踪到soapServer.cpp时,这一行收到错误:
soap->error=__ns1_hello(soap,soap_tmp___ns1_hello.ns2__hello,&ns2__helloResponse);
为什么我收到此错误?我正在使用来自gsoap的样本hello wsdl
答案 0 :(得分:1)
从错误消息(以及soapServer.cpp代码)中可以看出,您应该编写一个函数
int __ns1__hello(struct soap *soap,
_ns2_hello* helloReq,
_ns__helloResponse* helloResponse)
{
return SOAP_OK;
}
不是你写的功能。