野牛和 C++嵌套命名空间不会为我编译
我一整天都在绞尽脑汁试图解决这个问题。我有一个 bison/flex/c++
项目 我正在努力,忽略语义操作不完整并且在到达那里时会导致编译错误的事实,我无法让生成的解析器进行编译。我得到以下信息:
g++ -I. -g3 -std=c++0x -DYYDEBUG=1 -Werror -Wfatal-errors -pipe -fomit-frame-pointer -D_FORTIFY_SOURCE=2 -fstack-protector-all -o ndes.bin Parser.cpp Scanner.cpp Driver.cpp
Parser.cpp:174:3: error: prototype for ‘nde::script::Parser::Parser(nde::script::Driver&)’ does not match any in class ‘nde::script::Parser’
compilation terminated due to -Wfatal-errors.
make: *** [all] Error 1
现在,从错误来看,我认为修复起来很简单:头文件与源文件不匹配。所以,我打开它们,我找不到它们之间的区别。
我的项目的完整源代码位于上面的 github 链接中,使用“script”文件夹下的“rework”分支。我使用的是 g++ 4.6.1
、flex 2.5.35
和 bison 2.4.1
。有问题的文件是由 bison 生成的 Parser.[ch]pp
。
感谢您的帮助。
I've been banging my head all day trying to fix this. I have a bison/flex/c++
project I'm working on, ignoring the fact that the semantic actions are incomplete and will cause compile errors when it gets there, I can't get the generated parser to compile. I get the following:
g++ -I. -g3 -std=c++0x -DYYDEBUG=1 -Werror -Wfatal-errors -pipe -fomit-frame-pointer -D_FORTIFY_SOURCE=2 -fstack-protector-all -o ndes.bin Parser.cpp Scanner.cpp Driver.cpp
Parser.cpp:174:3: error: prototype for ‘nde::script::Parser::Parser(nde::script::Driver&)’ does not match any in class ‘nde::script::Parser’
compilation terminated due to -Wfatal-errors.
make: *** [all] Error 1
Now, judging from the error, I thought it would be straight forward to fix: the header file doesn't match the source file. So, I open them up, and I can't find a difference between them.
The full source to my project is in the github link above, using the "rework" branch under the "script" folder. I'm using g++ 4.6.1
, flex 2.5.35
, and bison 2.4.1
. The files in question are Parser.[ch]pp
which are generated by bison.
Thank you for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在命名空间中前向声明
class Driver
。Forward-declare
class Driver
in the namespace.