typedef map<string,vector<XmlNodeInfo>> 出错
我在头文件ifatclientconstant.h中定义了一个结构体:
typedef struct tagXmlNodeInfo
{
string name;
string desc;
string source;
string size;
string value;
string strDefVal;//默认值
string strAlias; //别名
}XmlNodeInfo;
在另一个文件中这样写:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include "expat/xmlparse.h"
#include "ifatclientconstant.h"
using namespace std;
typedef map <string,vector<XmlNodeInfo>> ParaMap;
typedef map <string,vector<XmlNodeInfo>> requestMap;
typedef map <string,vector<XmlNodeInfo>> responseMap;
typedef map <string,vector<XmlNodeInfo>> hheaderMap;
class CZteXmlFileImp
{
public:
CZteXmlFileImp();
~CZteXmlFileImp();
string GetRequestConfig(string sRequestID,string sType,string sKey);
vector<tagXmlNode> GetRequestConfigList(string sRequestID,string sType);
//static void XMLCALL startElement(void *userData, const char *name, const char **atts)
// static void XMLCALL endElement(void *userData, const char *name)
bool LoadXmlFile(string strfilename);
private:
string m_strxmlFileName;
map <string,vector<XmlNodeInfo>> m_paraMap;
map <string,vector<XmlNodeInfo>> m_requestMap;
map <string,vector<XmlNodeInfo>> m_responseMap;
map <string,vector<XmlNodeInfo>> m_httpMap;
XML_Parser parser;
};
但不知道为什么总是编译不过,提示 error C2146: syntax error : missing ',' before identifier 'ParaMap'
我已经3年没写C++,哪位大仙帮忙解答一下,谢谢
[解决办法]
这样试试:
类似<string,vector<XmlNodeInfo>>这样的写法,全部改成<string,vector<XmlNodeInfo> >(最右边的两个尖括号之间加一个空格)
[解决办法]