Question

I have a project that requires using flex and bison (with c++) - I do it with unix beacuse it's comfortable (just using flex, bison and g++). I need to use some 'graphic' library for my project and decided to go with WinApi. My question is: I want to include some functions based on WinApi in bison file -> generate parser, then generate scanner with flex, and compile these files with g++. I understand that this 'executive' program won't work with linux, but will it work with windows (I ask because it would compiled with linux). If not, is there an easy way to use flex, bison and g++ with windows that would generate the same output as with linux?

Was it helpful?

Solution

No, it won't work. If you include WinAPI stuff, g++ wouldn't be able to compile it, and even if it could, it wouldn't work on Windows. If you mean the output files from flex/bison, these will compile on any standard platform as they're 'mostly' standard conformant code.

It's easy enough to use flex/bison with Windows. There's several ports of it, like this, but you can also use it with Cygwin. They work just like the Linux versions.

You can find an example on how to integrate Flex/Bison tools with Visual Studio here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top