错误:“列表”不是“std”的成员,错误:模板参数 2 无效
error: ‘list’ is not a member of ‘std’ and error: template argument 2 is invalid
我正在尝试编译我的头文件,但我遇到了无法弄清楚的错误。
我想创建一个包含 3 个映射的结构:-从单个单词到计数的映射-从单词对映射到计数- 从单个单词映射到以下单词列表
我的头文件中的代码:
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <string>
#include <cctype>
#include <vector>
#include <algorithm>
#include <map>
typedef struct {
std::map<std::string, int> firstCounts;
std::map<std::string, int> pairCounts;
std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.
} LanguageModel;
我得到的错误:
> LangModel.h:24:23: error: ‘list’ is not a member of ‘std’
> std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.
> ^
> LangModel.h:24:23: error: ‘list’ is not a member of ‘std’
> LangModel.h:24:38: error: template argument 2 is invalid
> std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.
> ^
> LangModel.h:24:38: error: template argument 4 is invalid
> LangModel.h:24:44: error: expected unqualified-id before ‘>’ token
> std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.
你忘了添加
#include <list>
#include <list>
呢?您缺少标头包含。
相关文章:
- 如何通过参数抛出错误消息
- 我收到同义重复编译器错误。我应该如何修复"类型"X"的参数与类型"X"的参数不兼容?
- 错误 没有与参数列表匹配的重载函数"getline"实例
- 为什么 std::绑定错误参数可以成功?
- 在函数中使用 const int size 参数创建数组会在 Visual Studio 中抛出错误 C++:表达式的计
- g++ 为 transform() 的参数生成错误
- 如何在C++中使用 Void 而不会收到有关参数的错误
- 错误:参数中无效地使用了无效表达式
- xgboost 构建错误:参数包未扩展为"..":
- src/caffe/parallel.cpp:70:1:错误:“参数”未命名类型
- OpenCV 错误:ERClassifierNM1 中的错误参数
- 为什么显示错误:参数太少而无法正常工作
- 算法错误:参数无法从对中掩盖 1
- 类模板方法的专用化,类型名称是类模板 - 错误:参数处的类型/值不匹配
- C++连接函数错误-参数无效
- 错误:参数无效
- (自适应)opencv中的阈值错误(cvarrToMat中的错误参数(未知数组类型))
- OpenCV错误:cvGetSize中的错误参数(数组应该是CvMat或IplImage)
- OpenCV 2.2:未知函数中的错误参数,文件.. .ocv OpenCV modulescoresr
- 错误:参数声明的存储类说明符无效