Flex generates code which breaks MSVC build

  • Alex

    Alex - 2007-04-06


    Flex, or Bison, generates headers which unconditionally #include <unistd.h>. This file does not exist on windows, so it fails compilation, since it cannot include it.

    Is there any clean solution to this problem?

    • Okan Arikan

      Okan Arikan - 2007-04-06

         Hi Alex,

         You need to download the flex/bison for windows. The Visual C++ 2005 project is setup to automatically regenerate the parser files using flex/bison (make sure you clean the solution first).


    • Alex

      Alex - 2007-07-20


      I have GnuWin32 installed, and it still generates the same header file.

      There is no unistd.h as far as I am aware on windows, so it fails. Does/should the win32 version of bison generate a different header file that does not try to include unistd.h?

      • George Harker

        George Harker - 2007-07-20

        Hi Alex,

        My guess is that gnuwin32 flex / bison generates code that is intended to be compiled with gnuwin32 gcc sor similar.  That possibly comes with a unistd header?

        Perhaps there's a different version of flex / bison that you should use.

        Okan, which version is it that you use for the MSVC stuff?



    • Okan Arikan

      Okan Arikan - 2007-07-23

         You can try http://www.monmouth.com/~wstreett/lex-yacc/lex-yacc.html

         You can also just create an empty unistd.h.

         I'm afraid I can't locate which version of flex/bison I use for the windows distribution. There seems to be so many...



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks