Kahn
Kahn

Reputation: 773

Syntax Error: Declaration Expected. Why gsoap cannot read vector?

I am writing a web service in gsoap. When i compile this code, it gives me error:
Syntax Error: Declaration Expected
When i remove vector, it compiles successfully,

#include <stdsoap2.h>
#include <vector>

//gsoap ns service name:    PersonData
//gsoap ns service style:   document
//gsoap ns service encoding:    literal
//gsoap ns service namespace:   http://localhost/PersonData.wsdl
//gsoap ns service location:    http://localhost:7777
//gsoap ns schema namespace: urn:PersonData



class PersonInfo 
{
 public:
    std::string ID;
    std::string FirstName;
    std::string LastName;
    std::string Sex;
    std::string BirthDate;
    std::string BirthPlace;
    std::string SocialNumber;
};

class MultiplePersons
{
public:
       // It gives error only with vector 
    std::vector<PersonInfo> info; // **here is the error**
};
int ns__getSingleValue(std::string Param, std::string *result);

int ns__getFullRecord(std::string Param, MultiplePersons *result);

Upvotes: 2

Views: 2032

Answers (2)

user2021471
user2021471

Reputation:

The only error is that you should have included the import statement:
#import "stlvector.h"
NOT
#include "stlvector.h"

Before that, stlvector.h file should be in your working directory. In my case, i copied from /usr/share/gsoap/import/ to my Desktop folder where i stored my project files.
Source: gSoap Documentation

Upvotes: 3

Nemanja Ivanovic
Nemanja Ivanovic

Reputation: 46

Hmm, perhaps a namespace clash of some sort? For example "info" is an object declared in the stdsoap2.h header.

Upvotes: 0

Related Questions