2

我正在用 gsoap 编写一个 Web 服务。当我编译这段代码时,它给了我错误:
语法错误:预期声明
当我删除向量时,它编译成功,

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

2 回答 2

3

唯一的错误是您应该包含导入语句:
#import "stlvector.h"
NOT
#include "stlvector.h"

在此之前,stlvector.h 文件应该在您的工作目录中。就我而言,我从 /usr/share/gsoap/import/ 复制到我存储项目文件的桌面文件夹。
资料来源:gSoap 文档

于 2013-03-13T05:24:42.310 回答
0

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

于 2013-03-13T02:44:54.447 回答