C++ 指定了多个存储类

C++ 指定了多个存储类,c++,map,unordered,C++,Map,Unordered,在int main之前的一开始,我试图创建两种不同的方法来存储数据。我有一张无序的地图和一张普通的地图。我收到错误,指定了多个存储类 我只是想知道为什么C++不允许这样做?< /P> typedef struct dictionary{ std::string word; unsigned char hash[20]; std::string hex; int number; } a_dictionary; typedef struct brute{ int entry;

在int main之前的一开始,我试图创建两种不同的方法来存储数据。我有一张无序的地图和一张普通的地图。我收到错误,指定了多个存储类

我只是想知道为什么C++不允许这样做?< /P>
typedef struct dictionary{ 
 std::string word; 
unsigned char hash[20]; 

 std::string hex;
 int number;
 } a_dictionary;


 typedef struct brute{
int entry;
string secWord;
string secHex;
}

typedef std::unordered_map<std::string, dictionary*> Mymap;
typedef std::map<int, brute*> Solved;
int _tmain(int argc, _TCHAR* argv[])
{
string option;
string pass;
int choice=0;

Solved solution;
Mymap c1;
typedef结构字典{
字符串字;
无符号字符散列[20];
字符串十六进制;
整数;
}字典;
typedef struct brute{
整数输入;
字符串secWord;
字符串secHex;
}
typedef std::无序映射Mymap;
typedef std::已解决映射;
int _tmain(int argc,_TCHAR*argv[]
{
字符串选项;
串通;
int-choice=0;
解决方案;
MyMapC1;
错误C2159:指定了多个存储类 错误C2146:语法错误:标识符“Mymap”之前缺少“;” 错误C44:缺少类型说明符-int假设。C++不支持默认int 错误C2146:语法错误:标识符“c1”之前缺少“;” 错误C2065:“c1”:未声明的标识符


<错误> C2159:指定一个以上的存储类< /p>请显示C++代码,并复制粘贴编译器的确切错误信息。我已经把C++代码@ dasBrimeNeLink提供给您一个错误的行号。它对应的代码行是什么?您丢失了<代码>;<代码>结尾的<代码>结构Brutt
.Copy/paste error?是的。您也不需要在
struct
前面使用
typedef
。事实上,您确实不应该在那里使用
typedef
(有些编译器会忽略它,其他编译器会感到困惑)。