Title: Linker error when using gSOAP with 2 different wsdl files
Tags: c++;gsoap
Question: I am writing a C++ web service client using gSOAP on linux using 2 separate wsdl files in the same application. I have managed to get things working with just one wsdl file, and after reading documentation, went through the process of using wsdl2h on both files:

```    wsdl2h -o header.h wsdlfile1.wsdl wsdlfile2.wsdl
```

This worked fine and so I then did

```    soapcpp2 -i -I/usr/share/gsoap/import/ header.h
```

I then did all the usual namespace modifications in the typemap.dat as instructed. I now find that I have two .cpp and .h files of the type soapService1Proxy.cpp/h and soapService2Proxy.cpp/h. This is not quite what I expected, but regardless, I included both headers in my main function and created instances of each Proxy class and used in exactly the same way as I did for with just one wsdl file. I then compile with

```    g++ -DWITH_OPENSSL main.cpp soapC.cpp soapService1Proxy.cpp soapService2Proxy.cpp -lgsoapssl++ -lssl
```

which returns the error

```    /tmp/ccHNDAM4.o:(.data+0x0): multiple definition of `namespaces'
    /tmp/ccLJIHwV.o:(.data+0x0): first defined here
    collect2: ld returned 1 exit status
```

I know that the  'namepaces' refers to the array in the .nsmap files (which in this case are identical for each wsdl). I have included only one of these as the compiler complains of multiple definition if I include both. I really would appreciate it if anyone could tell me what I am doing wrong here as I have tried to follow the guidelines and gSOAP docs as faithfully as possible but simply cannot resolve this problem.


Here is the accepted answer: I've never used SOAP but I had a quick look at this user guide.

The last paragraph in section 7.1.4 says that the ```-n``` and ```-p``` options to ```soapcpp2``` help to resolve link conflicts. The link there to section 19.35 provides more information. It appears you have to run ```wsdl2h``` on each file separately using the ```-q``` option to provide a C++ namespace for each one. When you then run ```soapcpp2``` it will automatically apply ```-p``` and all you have to do is supply ```-n``` to have the ```namespaces``` array prefixed with your C++ namespace name followed by an underscore.

I haven't tried any of this but hopefully that will be enough to 
get you going again.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:04/19/12', 'FavoriteCount': 3.0, 'PostTypeId': 1, 'Tags': '<c++><gsoap>', 'Title': 'Linker error when using gSOAP with 2 different wsdl files', 'ViewCount': 4559, 'id': 10220155, 'user_AboutMe': '<p>I am a former postdoctoral research mathematician, and now a C++ software developer on Linux and Windows.</p>\n', 'user_AccountId': 1417400.0, 'user_DisplayName': 'mathematician1975', 'user_Reputation': 20881.0, 'user_Views': 4547.0, 'user_id': 1342730.0}}