I download and use Win flex-bison and everything is ok now.
Flex Lexer - iostream.h and others
-
24-06-2022 - |
Question
I am trying to use Flex to generate a scanner. The version is 2.5.4. from http://gnuwin32.sourceforge.net/packages/flex.htm website.
I am using the example from the Flex manual.
My enviroment is Windows 7 running VS2010.
So I execute the command flex -c++ scanner.l
to generate lex.yy.cc
.
I create a simple console app. and include the dir "C:\GnuWin32\include", containing flexlexer.h
and unistd.h
.
I also add the file lex.yy.cc
to VS2010 and compile and get the error:
c:\gnuwin32\include\flexlexer.h(47): fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
So I change iostream.h
for iostream
. But now I am getting:
c:\gnuwin32\include\flexlexer.h(72): error C2061: syntax error : identifier 'ostream'
The problem is that is defined in namespace std. I imagined I could compile flex to C++ without this kind of problem.
Am I doing something wrong? using wrong versions?
Thanks!
Solution