Синтаксическая ошибка: ожидается объявление. Почему gsoap не может прочитать вектор?

Я пишу веб-сервис в gsoap. Когда я компилирую этот код, он дает мне ошибку:

Синтаксическая ошибка: ожидается объявление

Когда я удаляю вектор, он успешно компилируется,

#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:PersonDataclass 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);

2

Решение

Единственная ошибка в том, что вы должны были включить оператор импорта:
#import «stlvector.h»
НЕ
#include «stlvector.h»

Перед этим файл stlvector.h должен находиться в вашем рабочем каталоге. В моем случае я скопировал из / usr / share / gsoap / import / в папку Desktop, где я сохранил файлы своего проекта.

Источник: документация gSoap

3

Другие решения

Хм, может быть, какое-то столкновение пространства имен? Например, «информация» — это объект, объявленный в заголовке stdsoap2.h.

0