I'm trying to compile my header file, but I'm getting errors I can't figure out.
I want to create a struct that contains 3 maps: -map from single words to counts -map from word pairs to counts -map from single words to list of following words
The code in my header file:
#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;
And the errors I'm getting:
> 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.
You forgot to add
#include <list>
What about #include <list>
? You are missing the header inclusion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With