error C2332: 'enum' : missing tag name
来源:互联网 发布:mysql 数据库快照 编辑:程序博客网 时间:2024/05/25 12:21
环境;win7 32,vs2013
代码:
#include <iostream>using namespace std;namespace MYSPACE{enum class choice{rock,paper,scissors};}typedef MYSPACE::choice Mchoice;int main(){Mchoice c = Mchoice::rock;return 0;}
报错:
1>d:\hbj\test\test0505\test0505\t.cpp(5): error C2332: 'enum' : missing tag name
1>d:\hbj\test\test0505\test0505\t.cpp(6): error C2236: unexpected 'class' 'MYSPACE::choice'. Did you forget a ';'?
1>d:\hbj\test\test0505\test0505\t.cpp(6): error C3381: 'MYSPACE::choice' : assembly access specifiers are only available in code compiled with a /clr option
1>d:\hbj\test\test0505\test0505\t.cpp(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\hbj\test\test0505\test0505\t.cpp(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\hbj\test\test0505\test0505\t.cpp(10): error C2143: syntax error : missing ';' before '}'
1>d:\hbj\test\test0505\test0505\t.cpp(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\hbj\test\test0505\test0505\t.cpp(18): error C2039: 'rock' : is not a member of 'MYSPACE::choice'
1> d:\hbj\test\test0505\test0505\t.cpp(6) : see declaration of 'MYSPACE::choice'
1>d:\hbj\test\test0505\test0505\t.cpp(18): error C2065: 'rock' : undeclared identifier
原因:vs2013使用了vs2010库,而vs2010不支持c++0x新增的强类型enum class
解决:在vs2013项目属性里,General->Platform Toolset,选择Visual Studio 2013 - Windows XP (v120_xp)或者Visual Studio 2013
参考:http://blog.csdn.net/zhanglei5415/article/details/1588258
http://zhidao.baidu.com/link?url=OTbxL2KFkfdunxC1dspL7dsa31zKQbHz-_kj6ZaB8O6TDhbpRmUyUqGUTV_DVr8pGS3msaXxxCg9i1aqXguMLd_i7YGP-XZEy62ELU2Utwm
http://blog.csdn.net/u012333003/article/details/20612267?utm_source=tuicool
http://www.cnblogs.com/tekkaman/p/3500904.html
http://www.xuebuyuan.com/1390932.html
http://blog.jobbole.com/44015/
- error C2332: 'enum' : missing tag name
- ADT:Tag <activity> missing required attribute name.
- usb200.h error missing tag 缺少标志
- error C2332: “struct”: 缺少标记名
- linux代码移植到windows下“error missing struct tag”
- Error:(54) Tag <uses-permission> attribute name has invalid character '-'.
- Error:Tag <uses-permission> attribute name has invalid character ' '.
- HTTP ERROR: 404 missing core name in path with solr
- error C2143: syntax error : missing ';' before 'tag::id'的两种情况
- error C2143: syntax error : missing ';' before 'tag::id' 'BOOL' : redefinition; typedef cannot be ov
- Error:Tag <uses-permission> attribute name has invalid character '?'. Error:java.util.concurrent.Exe
- Word2010 Error:The name in the end tag of the element must match the element type in the start tag.
- ERROR Error: If ngModel is used within a form tag, either the name attribute must be set or the form
- Add enum alias name or change name
- [已解决]讯飞语音android集成时遇到Error:(35) Tag <uses-permission> attribute name has invalid character ' '.
- tag list refresh error
- Tag Character postion , '' Error!
- Tag Character postion , '' Error!
- 快速定位资源持有者
- maven setting.xml 配置说明
- 以图搜图相关资料
- bzoj2194 FFT
- HTML和css积累
- error C2332: 'enum' : missing tag name
- 学习笔记:自训练Cifar10网络数据结果
- android:contentDescription
- eclipse中outline图标含义
- 漫反射(diffuse reflection)
- 栈的线性存储
- 关于使用struts2-json-plugin 插件,Json返回List对象数据为空解决方案
- Convert JSON string 转 Map
- 离散型Hopfield神经网络在联想和识别上的应用