Qt C2236:意外令牌';结构';,你忘了吗'?C2332:';结构';缺少标记名

Qt C2236:意外令牌';结构';,你忘了吗'?C2332:';结构';缺少标记名,qt,c++11,templates,Qt,C++11,Templates,检查有类似错误的帖子。提出的任何解决办法都无助于克服这一问题 我已经检查了我所有的课程是否有“;”在定义的末尾……所有这些都已正确定义 我已经检查了包含标题文件的标题保护。他们都有警卫 这是构建QT项目(桌面GUI应用程序)的输出 除了上面提到的以外,这些错误的典型原因是什么 以下是错误的输出: include\ConfigServer.h(85):错误C2236:意外标记“struct”。你忘了一个“;”吗 include\ConfigServer.h(85):错误C2332:“结构”:缺少标

检查有类似错误的帖子。提出的任何解决办法都无助于克服这一问题

我已经检查了我所有的课程是否有“;”在定义的末尾……所有这些都已正确定义

我已经检查了包含标题文件的标题保护。他们都有警卫

这是构建QT项目(桌面GUI应用程序)的输出

除了上面提到的以外,这些错误的典型原因是什么

以下是错误的输出:

include\ConfigServer.h(85):错误C2236:意外标记“struct”。你忘了一个“;”吗

include\ConfigServer.h(85):错误C2332:“结构”:缺少标记名

这个“ConfigServer.h”文件包括“BlockParam.h”、“CommsInfo.h”和“GeoInfo.h”,我以前在一个单独的控制台项目上编译过这些文件以测试它们的使用。他们在一个控制台程序上工作

有什么见解吗

#ifndef CONFIGSERVER_H
#define CONFIGSERVER_H

#include <iostream>
#include <iterator>

#include <QObject>
#include <QMap>
#include <QString>
#include <QVector>
#include <QFile>
#include <QXmlStreamReader>
#include <QDebug>

#include "BlockParam.h"
#include "CommsInfo.h"
#include "GeoInfo.h"




#define _delete(x) { if(x) delete x; x = nullptr;}

#define DEBUG 1
#define SHOW(X,B)  { if(DEBUG) { std::cout << X << B <<std::endl ; } }
#define DISPLAY(X) { if(DEBUG) { std::cout << X <<std::endl ; } }




enum ENUM_PLATFORM {
    NOTSET = 0,
    SILSIM = 1,  // Desktop Platform
    PILSIM = 2,  // PIL Platform
    HILSIM = 3   // HIL Platform
};

enum ENUM_CONFIG
{
    GEOINFO  = 1,
    COMMS    = 2, 
    MDLPARAM = 3 
};


typedef QMap<QString,ConfigInfo*> CfgMap;


class ConfigServer
{
public:

    ConfigServer();
    ~ConfigServer();

    bool LoadXmlFile(const QString xmlParmFileName);
    bool Validate(Xpci* xpc);

    bool IsValidated();
    bool errorsOccurred();
    QVector<QString> getErrorStrings();

    template<class T>
    ConfigInfo *GetConfigInfo(QString _inface,QString _pty,bool ebl);

    template<class T>
    void DisplayContent(T* Cfg) const;

    CfgMap *getMap()  const;
    QVector<CfgMap> *getConfigList()  const;

    ENUM_PLATFORM  PLATFORM;
    ENUM_CONFIG    CONFIGURATION;

    QVector<QString> ErrStringsVector;

private:

    void readModelXmlToMap(QXmlStreamReader* reader,CfgMap* ConfigMap_);

    template<class T>
    bool readCurrentInterfaceElement(QXmlStreamReader* reader,CfgMap* ConfigMap_);

    template<class T>
    bool readCurrentPropertyElement(QXmlStreamReader* reader,QString interface,CfgMap* ConfigMap_);

    bool readCurrentDimensionElement(QXmlStreamReader* reader,unsigned &rowDim,unsigned &colDim);

    BlockParam  nullBlockParam;
    CommsInfo   nullCommsInfo;
    GeoInfo     nullGeoInfo;

    CfgMap*  ConfigMap = nullptr;
    QVector<CfgMap>  *ConfigList = nullptr;

    unsigned requisite;
    bool validated = false;
    bool errorFlag = false;

};



template<> bool        ConfigServer::readCurrentInterfaceElement<BlockParam>(QXmlStreamReader* reader,CfgMap* ConfigMap_) ;
template<> bool        ConfigServer::readCurrentInterfaceElement<CommsInfo>(QXmlStreamReader* reader,CfgMap* ConfigMap_) ;
template<> bool        ConfigServer::readCurrentInterfaceElement<GeoInfo>(QXmlStreamReader* reader,CfgMap* ConfigMap_) ;

template<> bool        ConfigServer::readCurrentPropertyElement<BlockParam>(QXmlStreamReader *reader,QString interface,CfgMap* ConfigMap_);
template<> bool        ConfigServer::readCurrentPropertyElement<CommsInfo>(QXmlStreamReader *reader,QString interface,CfgMap* ConfigMap_);
template<> bool        ConfigServer::readCurrentPropertyElement<GeoInfo>(QXmlStreamReader *reader,QString interface,CfgMap* ConfigMap_);

template<> ConfigInfo *ConfigServer::GetConfigInfo<BlockParam>(QString _inface,QString _pty,bool ebl);
template<> ConfigInfo *ConfigServer::GetConfigInfo<CommsInfo>(QString _inface,QString _pty,bool ebl);
template<> ConfigInfo *ConfigServer::GetConfigInfo<GeoInfo>(QString _inface,QString _pty,bool ebl);

template<> void ConfigServer::DisplayContent<BlockParam>(BlockParam* Cfg) const;
template<> void ConfigServer::DisplayContent<CommsInfo>(CommsInfo* Cfg) const;
template<> void ConfigServer::DisplayContent<GeoInfo>(GeoInfo* Cfg) const;




#endif // CONFIGSERVER_H
\ifndef CONFIGSERVER\u H
#定义配置服务器
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括“BlockParam.h”
#包括“CommsInfo.h”
#包括“GeoInfo.h”
#定义_delete(x){if(x)delete x;x=nullptr;}
#定义调试1
#在Windows头文件中定义SHOW(X,B){if(DEBUG){std::cout(通过Qt头文件间接包含),有一些宏定义可以归结为
#define interface struct
。然后函数声明会被破坏到

template<> bool ConfigServer::readCurrentPropertyElement<BlockParam>(
    ..., QString struct, ...);
模板布尔配置服务器::readCurrentPropertyElement(
…,QString结构,…);
QString结构
部分显然是无意义的,编译器会抱怨



最简单的解决方法是避免使用
接口
作为标识符。

为什么不将问题提取为一个问题,而不是将代码块放在这里?您可能会在该过程中发现原因…哪一行是85?第85行:对应于类定义后的三个模板声明。template bool ConfigServer::ReadCurrentPropertyElement回顾调查,我现在正在经历这个过程难以置信,编译器不喜欢两个不同的模板函数在它们的声明中共享相同的参数名称。一旦我使参数名称不同,它就起作用了。这是出乎意料的……没有关系对所描述的错误的解释。我认为定义是(was?)在combaseapi.h中。有一个像“interface”这样的通用名称被重新定义是一个令人不快的惊喜…对,我删除了interface。这就是罪魁祸首。