2011-01-13 67 views
0
class X_class{ 
public: 

struct extra 
{int extra1; 
int extra2; 
int extra3; 
}; 
enum a 
{ 
n,m}; 

struct x_struct{ 
char b; 
char c; 
int d; 
int e; 
std::map <int, extra> myExtraMap; 

}; 
}; 
在我的代码

我定义:在结构中包含一个std :: map?可以吗?

x_struct MYSTRUCT;

为什么我会编译错误编译上面的类?错误要么说: 1)预期;之前<就行---我在那里定义了地图(上图)如果我删除std :: 或者 2)error:invalid use of ::;错误:预期; <令牌之前

+0

它编译,为什么你说不要试试?让我知道。 – user553514 2011-01-13 21:53:17

+0

@user - 附注:我看到你正在试图弄清楚如何正确格式化你的代码。只需全选,然后点击{}按钮。或者将所有行缩进4个或更多空格(这是{}按钮的作用)。 – 2011-01-13 21:59:16

回答

8

也许你erorrs因为你没有#include <map>

相关问题