c++ - "ISO C++ forbids declaration of ' 列表 ' with no type"错误

标签 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

最佳答案

您必须包含 header <list> :

#include <list>

关于c++ - "ISO C++ forbids declaration of ' 列表 ' with no type"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34948495/

相关文章:

带有参数列表的python函数

c++ - 由于 show 函数导致的非法间接错误

python - 如何获取两个列表之间的所有映射?

c++ - 如何将 BOOST_BIND_OPERATOR( !=, not_equal ) 与未定义 != 运算符的类一起使用

c++ - 在模板类中使用模板方法

java - 使用 MyBatis 3 插入对象列表

python - 如何检查列表列表中的所有元素是否都是字符串

python - 在Python中返回按元音计数过滤的列表的函数

c++ - 连接 const_string 的

c++ - 4K 纹理流(多分辨率)