QLALR - QParser示例在Visual Studio 2008启动时崩溃

问题描述:

不幸的是我必须解析一种语言(JScript)。我开始研究如何使用Flex,知道Qt提供了一个称为QLALR的有用工具来生成解析器。 在\ util \ qlalr \ examples \ qparser中我找到了一个非常有趣的例子,它集成了flex生成的扫描器和qlalr生成的解析器。此外,从我的理解(但它不可能是真实的......)该示例引入了一个有用的QParser接口,以避免重写解析函数。为了编译它,我必须从http://sourceforge.net/projects/gnuwin32/files/flex/2.5.4a-1/flex-2.5.4a-1-lib.zip/download下载一个用于windows的unistd.h。它位于目录include中。在任何情况下,它无非是:QLALR - QParser示例在Visual Studio 2008启动时崩溃

/* 

This file is part of the Mingw32 package. 
* 
unistd.h maps (roughly) to io.h 
*/ 
#ifndef _STRICT_ANSI_ 

#include <io.h> 
#include <process.h> 

#endif 

使用这个文件我能够编译qparser例子,但是当我运行它,我进入主功能与错误消息之前得到一个崩溃:程序“[3736 ] qparser.exe:Native'已退出代码2(0x2)。

我也越来越以下警告消息:

1>lex.calc.c(903) : warning C4003: not enough actual parameters for macro 'calcwrap' 
1>lex.calc.c(1056) : warning C4018: '<' : signed/unsigned mismatch 
1>lex.calc.c(1238) : warning C4003: not enough actual parameters for macro 'calcwrap' 
1>lex.calc.c(1402) : warning C4996: 'isatty': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _isatty. See online help for details. 
1> c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(312) : see declaration of 'isatty' 
1>lex.calc.c(1402) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. 
1> c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(722) : see declaration of 'fileno' 
1>Linking... 
1>LINK : debug 
qparser.exe not found or not built by the last incremental link; performing full link 

我使用Visual Studio 2008在Windows 7和Qt 4.8.0从同一个包在那里我得到QLALR编译。

有些建议? 谢谢

好吧,我自己解决了这个问题。 问题是提供的.pro没有包含win32-msvc2008:CONFIG + = console指令。 我还建议你在calc.l的开头添加一个%选项nounistd和一个#include以便使用缺省include目录中提供的atty函数。