【问题标题】:gsoap undefined reference after successfully generating c++ code成功生成c++代码后gsoap未定义引用
【发布时间】:2012-04-16 00:35:51
【问题描述】:

我正在尝试使用 gsoap 生成的代码来使用来自 linux 系统的 C++ 源代码的 ASP .NET Web 服务。

我使用“wsdl2h -o”和“soapcpp2 -C -i”成功地从我的 wsdl 文件创建了代码,现在正在尝试编译一个简单的客户端

根据soap文档,我现在尝试编译一个简单的客户端: 尝试使用以下方法编译它:

c++ -o vts_webservice vts_webservice.cpp -lgsoap

我得到未定义的参考错误: 源代码:

#include "soapBasicHttpBinding_USCORECollectorServiceProxy.h"
#include "BasicHttpBinding_USCORECollectorService.nsmap"

int main()
{
        BasicHttpBinding_USCORECollectorServiceProxy collectorService;
        _ns1__GetAvailableConnections *avConn;
        _ns1__GetAvailableConnectionsResponse *avConnResp;

        if(collectorService.GetAvailableConnections(avConn, avConnResp) == SOAP_OK)
        {
                std::cout << "foo" << std::endl;
        }
        else
                std::cout << "bar..." << std::endl;
                //collectorService.soap_stream_fault(std::cerr);

        return 0;
}

c++ -o vts_webservice vts_webservice.cpp -lgsoap tmp cc3uVBgk.o(.text+0x1e): 在函数main': : undefined reference to BasicHttpBinding_USCORECollectorServiceProxy::BasicHttpBinding_USCORECollectorServiceProxyin-charge' tmp cc3uVBgk.o(.text+0x40): 在函数main': : undefined reference to BasicHttpBinding_USCORECollectorServiceProxy::GetAvailableConnections(ns1_GetAvailableConnections*, ns1_GetAvailableConnectionsResponse*)' tmp-cc3uVBgk.o(.text+0x9c):在函数main': : undefined reference to BasicHttpBinding_USCORECollectorServiceProxy::~BasicHttpBinding_USCORECollectorServiceProxy

有人对此有任何建议吗?我会非常感谢任何提示!

提前非常感谢, 喵喵

P.S.:这个超链接限制实在是太烦人了!我的帖子中没有任何超链接,只有 linux-filesystem-paths。啊!

【问题讨论】:

    标签: c++ gsoap undefined-reference


    【解决方案1】:

    我不确定,但从您所写的内容看来,您忘记在编译步骤中包含soapC.cpp 文件?当我构建我的应用程序时,我通常会得到类似的东西

        g++ -FLAGS main.cpp soapC.cpp soapProxyClass.cpp -o outputApp
    

    也许你已经在这样做了,但从你的帖子中并不明显(至少对我来说)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-21
      • 1970-01-01
      相关资源
      最近更新 更多