分类: C/C++
2009-11-16 20:06:03
//... |
//...
|
make之后出现错误:
g++ -c -I include -o main.o src/main.cc
In file included from src/main.cc:44:0:
include/Driver.h:19:1: 错误:expected unqualified-id before ‘namespace’
include/Driver.h:25:6: 错误:‘Driver’ has not been declared
include/Driver.h: 在函数‘void Error::skip()’中:
include/Driver.h:27:4: 错误:‘numOfErr’在此作用域中尚未声明
src/main.cc: 在函数‘int Error::main(int, char**)’中:
src/main.cc:62:39: 错误:‘Driver’ has not been declare
…………后面不再一一列举,反正都是因为Driver没声明引起的
我盯着Driver.h看了半天,这个namespace怎么不能定义呢,N次尝试之后,终于注意到了下面这条信息中的"before"
include/Driver.h:19:1: 错误:expected unqualified-id before ‘namespace’
而且前面有In file included from src/main.cc
也就是说这是编译main.cc时发生的错误,此时Driver.h作为一部分被include进来了
同样的,myError.h Lexer.h都被include进来了,而报的信息提示是在"namespace"前面,那就进
myError.h看看吧,果然找到了问题所在,其中有如下片段:
|