如何将flex和bison与Qt项目集成? [英] How to integrate flex and bison with Qt project?

查看:209
本文介绍了如何将flex和bison与Qt项目集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在git源代码控制下使用Qt4制作GUI程序( Github页面 ).项目的一小部分需要扫描和解析.所以我想在项目中使用flex和bison.我可以想到3种方式-

I am making a GUI program using Qt4, under git source control (Github page). Small part of project requires scanning and parsing. So I want to use flex and bison with the project. I can think of 3 ways-

  1. 使flex和bison文件不受项目和源代码控制.生成C源文件并将其添加到项目中.
  2. 将flex和bison文件添加到项目中,但分别运行flex和bison命令.
  3. 与IDE(Ubuntu 12.04上的Qt Creator)和源代码控制正确集成,以便在我构建flex和bison时生成词法分析器和解析器.

我显然想要第三种选择,但不知道该怎么做.

I obviously want third option, but have no idea how to do it.

请提出最佳选择和方法.还是有其他方法可以做到?

Please suggest the best option and the way to do it. Or there is any other way to do it?

注意-我希望该项目也可以是跨平台的,并且也要为Windows构建.

Note - I want the project to be cross platform, to build for Windows as well.

推荐答案

通过跟随@Bort注释中的链接,我能够将Flex和Bison很好地集成到我的Qt项目中.我在项目设置中添加了自定义构建步骤.下面是Qt Creator中的屏幕截图.

By following the link in @Bort's comment I was able to integrate Flex and Bison with my Qt project nicely. I added custom build steps in project settings. Below is the screenshot in Qt Creator.

我为此询问了一个相关问题-即使存在函数,也存在未定义的引用错误

I asked a related question for this - Undefined reference error even though the functions are present

这篇关于如何将flex和bison与Qt项目集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆