语法错误:需要声明.为什么gsoap不能读取vector

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

本文关键字:不能 gsoap 不能读 读取 vector 为什么 声明 错误 语法      更新时间:2023-10-16

我正在用gsoap编写一个web服务。当我编译这段代码时,它给了我错误:
语法错误:Declaration Expected
当我移除vector时,编译成功,

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

唯一的错误是您应该包含import语句:
#进口"stlvector.h"

不# include"stlvector.h"

在此之前,stlvector.h文件应该在您的工作目录中。在我的情况下,我从/usr/share/gsoap/import/复制到我的桌面文件夹,我存储了我的项目文件。
来源:gSoap Documentation

嗯,也许是某种名称空间冲突?例如,"info"是一个在stdsoap2.h头文件中声明的对象。