gpt4 book ai didi

c++ - 如何将多个 gsoap 客户端 web 服务编译成一个可执行文件?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:38:52 25 4
gpt4 key购买 nike

我将 gSOAP 用于网络服务,但我遇到了一个问题,我必须将 2 个 Web 服务编译成一个可执行文件,以及一些函数具有相同的名称而不是使用参数函数名称的其他前缀。

编译错误:

X.o: In function `soap_get_string(soap*, char**, char const*, char const*)':
X.cpp:8669: multiple definition of `soap_get_string(soap*, char**, char const*, char const*)'
Y.o:Y.cpp:4763: first defined here

在生成文件中:

wsdl2h -qlpr X.wsdl
wsdl2h Y.wsdl Y.xsd
soapcpp2 -qlpr -plpr -plprws $(GSOAP_IMPORT) -i -C X.h
soapcpp2 -psiwcprws $(GSOAP_IMPORT) -i -C Y.h

有人知道如何解决这个问题吗?

最佳答案

19.34 How to Combine Multiple Client and Server Implementations into one Executable The wsdl2h tool can be used to import multiple WSDLs and schemas at once. The service definitions are combined in one header file to be parsed by soapcpp2. It is important to assign namespace prefixes to namespace URIs using the typemap.dat file. Otherwise, wsdl2h will assign namespace prefixes ns1, ns2, and so on to the service operations and schema types. Thus, any change to a WSDL or schema may result in a new prefix assignment. For more details, please see Section 8.2. Another approach to combine multiple client and service applications into one executable is by using C++ namespaces to structurally separate the definitions or by creating C libraries for the client/server objects as explained in subsequent sections. This is automated with wsdl2h option -q. Both approaches are demonstrated by example in the gSOAP distribution, the samples/link (C only) and samples/link++ (C++ with C++ namespaces) examples.

关于c++ - 如何将多个 gsoap 客户端 web 服务编译成一个可执行文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8669377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com