VC ++ 8中的枚举语法错误 [英] Syntax error with enum in VC++8
本文介绍了VC ++ 8中的枚举语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,专家,
我在一个头文件中有一段代码,如下所示.
Hi Experts,
I have a piece of code in one header file as follows.
#pragma once
const unsigned int RATE = 100;
const unsigned int TIMEOUT = 20;
const unsigned int REPORT = 1000;
enum STATUS_TYPE1 {X = 0, Y = 1, Z = 2, A = 3};
enum STATUS_TYPE2 {D = 0, E = 1, F = 2, G = 3, H = 4};
但是,当我尝试构建项目时,出现以下错误.
But when I tried to build the project I am getting the following error.
"syntax error : missing '}' before 'constant'"
"syntax error : missing ';' before 'constant'"
"syntax error : 'constant'"
"missing ';' before '}'"
"syntax error : '}'"
所有这些错误都指向同一行(枚举STATUS_TYPE2 {D = 0,E = 1,F = 2,G = 3,H = 4};)
它正在浪费我的时间.任何人都可以帮助我吗?
注意:实际上,我正在将以上代码从VC6导出到VC8.
All these errors are pointing to the same line(enum STATUS_TYPE2 {D = 0, E = 1, F = 2, G = 3, H = 4};)
It is killing my time.. Can any one help me on this?
Note: Actually I am exporting the above code from VC6 to VC8.
推荐答案
这让我感到困惑.我不敢相信,我试图编译它:我是对的-它工作正常.问题出在别的地方.有一些你不向我们展示的东西. :-(
—SA
It looked puzzling to me. In disbelieve, I tried to compile it: I was right — it works fine. The problem is somewhere else; there is something you don''t show to us. :-(
—SA
这篇关于VC ++ 8中的枚举语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文