Search code examples
wsdlgsoap

Error in compiling using gsoap


I am trying to compile the files after generating from these steps:- (1) wsdl2h -o calc.h http://www.genivia.com/calc.wsdl (2) soapcpp2 -j -CL calc.h (3) Creating a main.cpp with the following code:-

#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. After it I compile issuing the command:- g++ -o calcclient main.cpp soapcalcProxy.cpp soapC.cpp -lgsoap++

I get the following errors:-

/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

Please help in compiling.


Solution

  • I solved this. I was thinking the lib is in /usr/lib but it was in /usr/local/lib. I included -L/usr/local/lib while compiling, and it worked.