How to integrate flex and bison with Qt project?

删除回忆录丶 提交于 2020-01-02 07:30:33

问题


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. To keep flex and bison files out of project and source control. Generate the C source files and add it to project.
  2. Add flex and bison files to project, but run flex and bison commands separately.
  3. Integrate properly with IDE (Qt Creator on Ubuntu 12.04) and source control, so that when I build the flex and bison is called to generate lexer and parser.

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?

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


回答1:


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



来源:https://stackoverflow.com/questions/14412446/how-to-integrate-flex-and-bison-with-qt-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!