VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
来源:互联网 发布:腾讯游戏礼包领取软件 编辑:程序博客网 时间:2024/06/05 16:50
VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
近来写程序时发现了一个问题,用 VC 编译 C语言是 总是提示一个错误:error C2143: syntax error : missing ';' before 'type'。考虑了很久也没有答案,于是上网搜索,终于在一位网友博客中找到了解决办法。解决方法如下:
把所有变量的声明放在可执行代码之前。
出现此问题的原因在于:将文件保存成了 *.c 格式。如果是 cpp 格式就能正常编译。
这是因为:在 ANSI C 或者 C++中,在可执行代码中随时定义变量是允许的,但是在K&R C中是不允许的,因此才会出现这个错误。VC6.0 、VS2008 都是用的 K&R C 来实现 C语言的,因此编译过程中会报错。
0 0
- VC++ 2005中编译C出错:error C2143: syntax error : missing ';' before 'type'
- VC++ 2005中编译C出错:error C2143: syntax error : missing ';' before 'type'
- VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
- VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
- VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
- VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing \';\' before \'type\'
- error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type'
- C语言 error C2143: syntax error : missing ';' before 'type'
- error C2143: syntax error : missing ';' before 'type' in Visual C++
- 奇怪的 error C2143: syntax error : missing ';' before 'type'
- VC6.0 error C2143: syntax error : missing ';' before 'type'。。
- php 变量值比较注意事项
- ARC 总结
- 24位二进制解析为有符号整数
- CodeForces 366A
- 设计模式(四)
- VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
- 安装Windows补丁KB947821报错0x8007000d The data is invalid
- UI_01.第一个ios UI
- 多线程模拟实现生产者/消费者模型
- Spark学习之编程进阶——累加器与广播(5)
- Android Scroller原理
- 回顾:Unity 游戏引擎发展历程
- http://blog.csdn.net/enuola/article/details/7917221
- Murano的Symphony和Mesos(Marathon)的package和imge全部做好了