我工作的一所学校实验室和指令,它说:别名使用VS的typedef
Change the typedef that defines Word_List to a alias declaration (using)
从我GOOGLE了,要做到这一点的方法是从改变:
typedef vector<Word_Entry> Word_List;
到:
using Word_List = std::vector<Word_Entry>;
但是当我编译,我得到以下错误:
error: expected nested-name-specifier before 'Word_List'
大部分代码:
#include <iostream>
#include <algorithm>
#include <list>
#include <string>
#include <vector>
#include <fstream>
#include <cctype>
#include <iomanip>
using namespace std;
struct Word_Entry
{
string ord;
unsigned cnt;
};
//typedef vector<Word_Entry> Word_List; <-This is what it used to look like
using Word_List = vector<Word_Entry>;
int main()
{
...
}
aditional的信息:
Yes, I am compiling with c++11
Word_Entry is a struct that stores 2 variables
I have the line "using namespace std;" in the begining of my code
I'm using mingw compiler
什么是编译器? – 2013-02-21 15:29:20
您是否对您的项目或生成文件启用了C++ 11规范? – deepmax 2013-02-21 15:30:16
我已添加aditional信息回答你的问题 – 2013-02-21 15:50:44