" ISO C ++禁止声明' list'没有类型"错误

时间:2016-01-22 13:59:46

标签: c++ list

我在下面包含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

1 个答案:

答案 0 :(得分:7)

您必须包含标题<list>

#include <list>