undefined reference to namespaces - gsoap error
Asked Answered
S

2

8

I am working in ubuntu, c++ code.

Using gsoap and wsdl2h -o header.h http://link1 http://link2 I've successfully succeeded to create .h, .cpp and .xml files. When I #include proxy1.h and #include proxy2.h and their nmsp files I receive the following error:

redefinition of "Namespace namespaces[]', previously defines here . 

How to solve this error? When I use: stdsoap2 -i -C -Iimport header.h can't I specify a different namespace for each url? I would like to mention that stdsoap.cpp is used when I compile the code. In stdsoap the namespace is called namespaces.

thx

Schaffel answered 1/6, 2011 at 7:22 Comment(0)
S
7

You must define WITH_NONAMESPACES when importing multiple webservices in a single client.

See How to Create Client/Server Libraries and soapcpp2 Options.

Shaia answered 14/6, 2011 at 12:7 Comment(1)
This is only if you are compiling stdsoap2.cpp file along with the generated code. If you are linking one of the gsoap libraries which were installed through Ubuntu repo. It wont solve your problem. One way it declare `struct Namespace *namespaces = NULL;' in global scope so that the linker can find it.Plumbic
B
0

Using gsoap 2.8.91 from the EPEL for RHEL 8 repo, I needed to "struct Namespace namespaces[] = {};" somewhere in the global space. You need to add this if you "#include <stdsoap2.h>". Since I was only using that include in one class, I added my global reference there.

Sanjaya's comment above should work for older versions of gsoap.

Birnbaum answered 22/7, 2021 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.