一个小问题,c++
2004-10-16 00:24
330 查看
void main()
{
for(int i=0;i<2;i++)
{
//code
}
}
VC++编译器给出以下的信息:
--------------------Configuration: X - Win32 Debug--------------------
Compiling...
X.C
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ')' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2065: 'i' : undeclared identifier
E:\Project\X.C(15) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
E:\Project\X.C(15) : error C2059: syntax error : ')'
E:\Project\X.C(16) : error C2143: syntax error : missing ';' before '{'
执行 cl.exe 时出错.
X.exe - 1 error(s), 0 warning(s)
------------------------------------------------------------------------------------
现在把程序改成这样:
void main()
{
int i;
for(i=0;i<2;i++)
{
//code
}
}
编译通过.
很郁闷,为什么啊?
高手请指教!
{
for(int i=0;i<2;i++)
{
//code
}
}
VC++编译器给出以下的信息:
--------------------Configuration: X - Win32 Debug--------------------
Compiling...
X.C
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ')' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2065: 'i' : undeclared identifier
E:\Project\X.C(15) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
E:\Project\X.C(15) : error C2059: syntax error : ')'
E:\Project\X.C(16) : error C2143: syntax error : missing ';' before '{'
执行 cl.exe 时出错.
X.exe - 1 error(s), 0 warning(s)
------------------------------------------------------------------------------------
现在把程序改成这样:
void main()
{
int i;
for(i=0;i<2;i++)
{
//code
}
}
编译通过.
很郁闷,为什么啊?
高手请指教!
相关文章推荐
- 解答一个C++问题
- C/C++——一个因为unsigned引发的大问题
- 使用eclipse for c++的一个报错问题
- 一个C++问题,请大家帮帮忙啊
- [初]一个C++关于string的小问题
- 写C++代码遇到的一个问题,错误已经在代码中注释了
- 一个非C++程序员问的C++问题(转)
- C++ STL 如何安全的将一个含有指针变量的类对象放在容器中? 避免浅拷贝问题
- 一个VS2005无法调试C++的问题
- c++的getline一个关于缓冲区的一个小问题
- C++中如何返回一个数组以及可能会遇到的问题geekband
- 一个IQ问题的C++模拟
- 一个有趣的C++问题
- 一个C++小问题
- C++的一个问题
- Face Alignment at 3000FPS(C++版)工程配置一个大问题的解决
- 一个基础但是隐晦的c++语法问题
- 关于C++中子类调用父类方法的一个问题
- 三种实现交换的方法,其中一个诡异的swap函数——C/C++语言(问题求助)
- C++编译时出现的一个问题,求教高人