gsoap calc ++示例最终出现错误

时间:2018-06-04 20:10:31

标签: gsoap

我正在尝试在查看此处给出的教程https://www.genivia.com/examples/calc++/index.html之后构建calc ++,但最终会出现错误,如下所示。

以下是我遵循的步骤

  1. wsdl2h -o calc.h http://www.genivia.com/calc.wsdl [这创造了 头文件,我不知道该怎么做文件" typemap.dat"档案如此 我继续第二步]

  2. soapcpp2 -j -r -CL calc.h [这会生成所需的文件,我下载了calcclient.cpp,将stdsoap2.h和stdsoap2.cpp复制到同一个文件夹中]

  3. g ++ -o calcclient calcclient.cpp stdsoap2.cpp soapC.cpp soapcalcProxy.cpp [此步骤以下面显示的错误结束]

  4. 任何人都可以帮我这个,我是全新的gsoap并试图用它构建一些东西所以我决定从gsoap例子开始,但是得到了这个大错误。我在Ubuntu中这样做并遵循教程中给出的确切步骤。请检查下面的错误

    calcclient.cpp: In function ‘int main(int, char**)’:
    calcclient.cpp:58:29: error: no matching function for call to ‘calcProxy::add(double&, double&, double*)’
       calc.add(a, b, &result);
                             ^
    In file included from calcclient.cpp:41:0:
    soapcalcProxy.h:74:21: note: candidate: virtual int calcProxy::add(double, double, double&)
         virtual int add(double a, double b, double &result)
                     ^
    soapcalcProxy.h:74:21: note:   no known conversion for argument 3 from ‘double*’ to ‘double&’
    soapcalcProxy.h:76:21: note: candidate: virtual int calcProxy::add(const char*, const char*, double, double, double&)
         virtual int add(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
                     ^
    soapcalcProxy.h:76:21: note:   candidate expects 5 arguments, 3 provided
    calcclient.cpp:61:29: error: no matching function for call to ‘calcProxy::sub(double&, double&, double*)’
       calc.sub(a, b, &result);
                             ^
    In file included from calcclient.cpp:41:0:
    soapcalcProxy.h:78:21: note: candidate: virtual int calcProxy::sub(double, double, double&)
         virtual int sub(double a, double b, double &result)
                     ^
    soapcalcProxy.h:78:21: note:   no known conversion for argument 3 from ‘double*’ to ‘double&’
    soapcalcProxy.h:80:21: note: candidate: virtual int calcProxy::sub(const char*, const char*, double, double, double&)
         virtual int sub(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
                     ^
    soapcalcProxy.h:80:21: note:   candidate expects 5 arguments, 3 provided
    calcclient.cpp:64:29: error: no matching function for call to ‘calcProxy::mul(double&, double&, double*)’
       calc.mul(a, b, &result);
                             ^
    In file included from calcclient.cpp:41:0:
    soapcalcProxy.h:82:21: note: candidate: virtual int calcProxy::mul(double, double, double&)
         virtual int mul(double a, double b, double &result)
                     ^
    soapcalcProxy.h:82:21: note:   no known conversion for argument 3 from ‘double*’ to ‘double&’
    soapcalcProxy.h:84:21: note: candidate: virtual int calcProxy::mul(const char*, const char*, double, double, double&)
         virtual int mul(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
                     ^
    soapcalcProxy.h:84:21: note:   candidate expects 5 arguments, 3 provided
    calcclient.cpp:67:29: error: no matching function for call to ‘calcProxy::div(double&, double&, double*)’
       calc.div(a, b, &result);
                             ^
    In file included from calcclient.cpp:41:0:
    soapcalcProxy.h:86:21: note: candidate: virtual int calcProxy::div(double, double, double&)
         virtual int div(double a, double b, double &result)
                     ^
    soapcalcProxy.h:86:21: note:   no known conversion for argument 3 from ‘double*’ to ‘double&’
    soapcalcProxy.h:88:21: note: candidate: virtual int calcProxy::div(const char*, const char*, double, double, double&)
         virtual int div(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
                     ^
    soapcalcProxy.h:88:21: note:   candidate expects 5 arguments, 3 provided
    calcclient.cpp:70:29: error: no matching function for call to ‘calcProxy::pow(double&, double&, double*)’
       calc.pow(a, b, &result);
                             ^
    In file included from calcclient.cpp:41:0:
    soapcalcProxy.h:90:21: note: candidate: virtual int calcProxy::pow(double, double, double&)
         virtual int pow(double a, double b, double &result)
                     ^
    soapcalcProxy.h:90:21: note:   no known conversion for argument 3 from ‘double*’ to ‘double&’
    soapcalcProxy.h:92:21: note: candidate: virtual int calcProxy::pow(const char*, const char*, double, double, double&)
         virtual int pow(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
                     ^
    soapcalcProxy.h:92:21: note:   candidate expects 5 arguments, 3 provided
    

1 个答案:

答案 0 :(得分:0)

也许您将一个或多个参数作为指针传递。正确的代理调用应如下所示:

#include "soapcalcProxy.h"
#include "calc.nsmap"

  double a, b, result;
  calcProxy calc("http://server.com/path");
  a = 1.23;
  b = 4.56;
  int err = calc.add(a, b, result);