2012-01-12 8 views
1

残念ながら、言語(JScript)を解析する必要があります。私は、Qtがパーサを生成するためにQLALRという便利なツールを提供していることを知って、Flexの使い方を研究し始めました。 \ util \ qlalr \ examples \ qparserには、フレックス生成されたスキャナとqlalrで生成されたパーサーを統合した非常に興味深い例が見つかりました。また、私が理解したところから(しかしそれは真実ではないかもしれません...)この例では、構文解析関数を書き直すのを避けるために有用なQParserインタフェースを紹介しています。それをコンパイルするために、ウィンドウのunistd.hをhttp://sourceforge.net/projects/gnuwin32/files/flex/2.5.4a-1/flex-2.5.4a-1-lib.zip/downloadからダウンロードしなければなりませんでした。それはディレクトリのインクルードにあります。私はqparserの例をコンパイルすることができました。このファイルを使用してQLALR - Visual Studio 2008の起動時にQParserのサンプルがクラッシュする

/* 

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 

が、私はそれを実行すると、私はエラーメッセージを表示して、main関数に入る前にクラッシュを取得:いずれのケースでは、より多くの何物でもありませんプログラム「[3736 ] qparser.exe:Native 'がコード2(0x2)で終了しました。

私はまた、次の警告メッセージを取得しています:私はQLALRを得た同じパッケージからコンパイルのWindows 7とQt 4.8.0にVisual Studio 2008を使用してい

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 

いくつかの提案がありますか? ありがとう

答えて

1

私は自分で解決しました。 問題は、提供された.proにwin32-msvc2008:CONFIG + = consoleディレクティブが含まれていないことです。 また、デフォルトのインクルードディレクトリにあるatty関数を使うために、calc.lの先頭に%nounistdと#includeを追加することをお勧めします。

関連する問題