我正在尝试从这些步骤生成后编译文件: -
(1)wsdl2h -o calc.h http://www.genivia.com/calc.wsdl
(2)soapcpp2 -j -CL calc.h
(3)使用以下代码创建main.cpp: -
#include "calc.nsmap" // XML namespace mapping table (only needed once at the global level)
#include "soapcalcProxy.h" // the proxy class, also #includes "soapH.h" and "soapStub.h"
int main()
{
calcProxy calc;
double sum;
if (calc.add(1.23, 4.56, sum) == SOAP_OK)
std::cout << "Sum = " << sum << std::endl;
else
calc.soap_stream_fault(std::cerr);
calc.destroy(); // same as: soap_destroy(calc.soap); soap_end(calc.soap);
}
我收到以下错误: -
/tmp/ccA5Ergj.o: In function `soap_ignore_element(soap*)':
soapC.cpp:(.text+0x112d): undefined reference to `soap_ignore'
/tmp/ccA5Ergj.o: In function `soap_putelement':
soapC.cpp:(.text+0x149b): undefined reference to `soap_element_empty'
collect2: error: ld returned 1 exit status
请帮助编译。
答案 0 :(得分:0)
我解决了这个问题。我以为lib在/ usr / lib中,但它在/ usr / local / lib中。我在编译时包含了-L / usr / local / lib,并且工作正常。