Take the 2-minute tour ×

I'm using flex (lexical analyzer, not Adobe Flex) on a project. However, I want to be able to compile on Windows platforms as well, but the Windows version's newest version is only 2.5.4a, so it won't compile my file for version 2.5.35. And no, I can't downgrade to the highest supported Windows version.

Anyone know about plans to upgrade the windows version, or have a suggestion to compile on windows anyway?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You can ask on the mailing list, or get involved in the Flex project yourself. I think the code-base for Flex has remained static for a while, but I don't know who maintains the Windows port. In the interim...

I would recommend including the produced source in your project.

  1. Generate the lexer on a Linux system to produce your lex.c/lex.h files (or whatever)
  2. Include those files in your Win32 C source before you build

If you don't have direct access to a Linux system, a virtual machine might be a good idea. The Flex source should be complaint to some C standard that builds on Windows, but most of the POSIX differences can be altered to use Win32 API fairly easily.

Maybe distribute as:


This way systems with a modern flex can generate the source from the lex file, and Windows systems compiling the source can use the complementary pre-processed C files.

Short of using some user-space POSIX (Cygwin or whatever).

A little bit of tweaking required, but isn't that portability for you!

share|improve this answer
+1, personally I just use Cygwin when the .lex/.y files change. –  Simeon Pilgrim Jul 20 '09 at 23:44
Could you explain how to use Cygwin to compile using the Linux version of Flex? I did try to use it for this project, but didn't get very far. –  Jorn Jul 25 '09 at 20:02
How to compile the Flex source itself, or generate the C files from Flex? There should be a cygwin version of Flex already –  Aiden Bell Jul 26 '09 at 11:24

Windows builds of flex 2.5.35 do exist, but unfortunately they are not self contained. You can download the MINGW build here, and the Cygwin build here; see also another stackoverflow question. Each build requires that its respective (MINGW or Cygwin) kernel be installed.

share|improve this answer

Your Answer


