missing ';' before 'namesapce'错误的解决
2012-03-01 18:11
295 查看
作者:朱金灿
来源:http://blog.csdn.net/clever101
上午开发时出现一个编译错误:missing ';' before 'namesapce',我仔细检查了出错的那句代码,感觉任何没有问题。删掉再重新输入也依然出现这个问题。上网查了下资料,找到了答案:
This can happenwhen one include file has an error (or missing semicolon) at the end of thefile and that file is included immediately before another. The error that isgenerated indicates that there is a problem in the second include file ratherthan the first. So as a starting point, make sure that, if you have a filethat's included before Time.h, that is doesn't have any errors in it.
Pasting thecontent of your .h and .cpp files would certainly be helpful rather than justthe error message.
上面是说某个包含的头文件有一个错误(可能是缺少一个分号)。看到这里,我想到刚刚新建的一个类的头文件声明是不是缺少分号呢?一去检查,发现果然缺少分号。该错误的诡异之处在于编译器并不把错误提示在缺少分号的那个头文件,而是其它头文件,结果就是导致了让人找了很久也百思不得其解。我的编译环境是VS 2005+sp1, Win XP + sp3。
参考文献:
1. ErrorC2143 (missing ; before namespace) in MS VC include
来源:http://blog.csdn.net/clever101
上午开发时出现一个编译错误:missing ';' before 'namesapce',我仔细检查了出错的那句代码,感觉任何没有问题。删掉再重新输入也依然出现这个问题。上网查了下资料,找到了答案:
This can happenwhen one include file has an error (or missing semicolon) at the end of thefile and that file is included immediately before another. The error that isgenerated indicates that there is a problem in the second include file ratherthan the first. So as a starting point, make sure that, if you have a filethat's included before Time.h, that is doesn't have any errors in it.
Pasting thecontent of your .h and .cpp files would certainly be helpful rather than justthe error message.
上面是说某个包含的头文件有一个错误(可能是缺少一个分号)。看到这里,我想到刚刚新建的一个类的头文件声明是不是缺少分号呢?一去检查,发现果然缺少分号。该错误的诡异之处在于编译器并不把错误提示在缺少分号的那个头文件,而是其它头文件,结果就是导致了让人找了很久也百思不得其解。我的编译环境是VS 2005+sp1, Win XP + sp3。
参考文献:
1. ErrorC2143 (missing ; before namespace) in MS VC include
相关文章推荐
- missing ';' before 'namesapce'错误的解决
- [原]missing ';' before 'namesapce'错误的解决
- 使用sndPlaySound时的错误syntax error : missing ';' before identifier 'MMVERSION'的解决
- SQLAPI 错误:error C2146: syntax error : missing ';' before identifier 'fd' 解决办法
- 编译错误syntax error : missing ';' before 'type'原因探寻
- yntax error : missing ';' before 'using' 的解决办法
- 编译错误syntax error : missing ';' before 'type'
- Cocos2dx 3.6源码编译错误:syntax error : missing ')' before '{'
- syntax error : missing ';' before identifier 'PVOID64' (DSHOW开发编译错误 winnt.h)
- syntax error : missing ';' before 'type'错误
- 编译错误syntax error : missing ';' before 'type'原因探寻
- syntax error : missing ';' before 'type'错误
- 编译错误syntax error : missing ';' before 'type'原因探寻
- VC中出现error C2143: syntax error : missing ';' before '*'错误的解决方案
- VS编译错误:syntax error : missing ';' before 'type'
- C中“fatal error C1075: end of file found before the left brace '{'”错误的几种可能解决方法
- 关于Error 1 error C1189: #error : "include 'stdafx.h' before including this file这个错误的解决方法
- keil提示:missing ';' before 'XXX'但又找不到是哪里少了分号——已解决!
- VS2005错误 missing ';' before identifier 'PVOID64
- afxstat_.h(164) : error C2143 syntax error : missing ';' before '*'报错的解决