使用gsoap进行编译时出错

时间:2018-05-22 08:58:13

标签: wsdl gsoap

我正在尝试从这些步骤生成后编译文件: - (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);
}
  1. 之后我编译发出命令: - g ++ -o calcclient main.cpp soapcalcProxy.cpp soapC.cpp -lgsoap ++
  2. 我收到以下错误: -

    /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
    

    请帮助编译。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。我以为lib在/ usr / lib中,但它在/ usr / local / lib中。我在编译时包含了-L / usr / local / lib,并且工作正常。