8

I apologize if this is a dumb question, but I have 0 experience with this tool and wanted to know if I'm going about using it properly. I've downloaded flex which, upon compiling my lex file, produces a C file which then needs to be compiled separately. Is this the best way to do it?

Lesmana
  • 25,663
  • 9
  • 82
  • 87
John Roberts
  • 5,885
  • 21
  • 70
  • 124
  • In a previous life I had to hack on a project running on SCO Unix and Windows NT (or was it still 98?). What I did in the end was to run bison and flex on my Linux box, and compile on SCO and Windows. Not exactly elegant, but got the job done. – vonbrand Feb 02 '13 at 19:49

2 Answers2

7

It's possible to set up a Visual Studio project that uses flex as a custom build step in order to automatically invoke flex and then compile the generated file. I taught a compilers course last summer and we have instructions on how to get flex and a sample project file available on the archived course website. You should look under the announcement labeled "Visual Studio Starter Files for PP1."

Hope this helps!

Lesmana
  • 25,663
  • 9
  • 82
  • 87
templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
3

Using Win flex-bison with visual studio is quite easier and straightforward. You can find it at Win Flex-Bison.

Hello W
  • 639
  • 8
  • 17