"ISO C++ forbids declaration of 'list' with no type"错误

"ISO C++ forbids declaration of 'list' with no type" error

本文关键字:with no type 错误 list ISO of forbids C++ declaration      更新时间:2023-10-16

我在包含以下内容的每一行上不断收到以下错误list<string>

  • ISO C++ forbids declaration of 'list' with no type
  • expected ';' before '<' token

#ifndef __REGNAMEGENERATOR_H
#define __REGNAMEGENERATOR_H
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <sstream>
#define Max_reg_Num 1000
using namespace std;
class RegNameGenerator{
private:
    int intRegNumber;
    int realRegNumber;
    list<string> UsedIntReg; // error
    list<string> UsedRealReg; // error
public:
    RegNameGenerator();
    ~RegNameGenerator();
    string generateIntReg();
    string generateRealReg();
    list <string> getUsedIntReg(); // error
    list <string> getUsedRealReg(); // error
    int getIntRegNum();
    int getRealRegNum();
};
#endif

您必须包含标头<list>

#include <list>