失踪 ;不变之前 [英] missing ; before constant
本文介绍了失踪 ;不变之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我的代码有问题
静态常数变量错误,使我缺少错误;之前不断如何解决这个问题
关于
Hi all
I have a problem in my code
the static constant variable error it gives me error missing ; before constant how to solve this issue
Regards
推荐答案
此类编译器错误通常指向前一行的语法错误.修复 就像添加;
一样容易,就像上面建议的那样.但是您的错误消息听起来更像是实际行中的语法错误.
您提到了静态常量变量,它将是在类(或结构)中声明的常量,如下所示:
Compiler errors like this usually point to a syntax error in the previous line(s). Fixing it may be as easy as appending a;
, like suggested above. But your error message sounds more like there is a syntax error in that actual line.
You mentioned a static constant variable, that would be a constant declared within a class (or struct) like this:
class Foo {
public:
static const int bar;
};
要定义该常量,您的源代码必须分配该常量,如下所示:
To define that constant, your source code must assign that constant like this:
const int Foo::bar = 7;
那是你做的吗?您是否使用了相同的语法?也许您忘记了=
?如果不是这样,请发布导致问题的代码.
Is that what you did? Did you use the same syntax? Maybe you forgot the =
? If that is not it, please post the code that causes the problem.
这篇关于失踪 ;不变之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文