语法错误:需要声明.为什么gsoap不能读取vector
Syntax Error: Declaration Expected. Why gsoap cannot read vector?
我正在用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头文件中声明的对象。
相关文章:
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 为什么在没有显式默认构造函数的情况下,将另一个结构封装在联合中作为成员的结构不能编译
- 为什么我的for循环不能正确获取argv
- 不能在初始值设定项列表中将非常量表达式从类型 'int' 缩小到'unsigned long long'
- 为什么我不能在 FOR LOOP 中使用 i/10,C++?
- 为什么我不能在不创建字符串变量的情况下使用函数的字符串输出
- 为什么模板类中的对象不能返回值
- 为什么我不能在一个类的不同行中声明和定义成员变量?
- 为什么我不能在 C++ 中的特定函数重载中调用同一函数的任何其他重载?
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- 数组长度,为什么从命令行获取时不能使用它?
- Windows/Cygwin - 不能使用 pybind11 - 犯错误
- 为什么我不能使用 EGL 创建无头 OpenGl 上下文?
- 递归模板化函数不能分配给具有常量限定类型"const tt &"的变量"state"
- 为什么我不能将一个对象push_back到属于另一个类的对象向量中?
- 为什么我不能将 rand() 与数组的大小一起使用?
- 为什么虚函数不能是静态的和全局的?
- 为什么我不能在 while 循环中创建线程?
- 为什么这个音频包络不能通过开关的情况?
- 语法错误:需要声明.为什么gsoap不能读取vector