How To Setup FLEX in MS Visual 2008

I came to know about LEX and YACC when I was working in NEC Telecom Software Philippines that wasI think 2001 when Carlo my former colleague introduced me into it. He used it to parse the binary output (in file) to retrieve the groups of data to be translated into a human readable format. He used the LEX to create the parser. Since then I always wanted to know how he did that so that’s how I ended up with this e-book.

First you need to download “flex-2.5.4a-1.exe” from the internet and install it. Make sure the environment path is set below after installation.


Try to test FLEX by typing flex in command window like below sample,


Now, try to create a simple LEX file and save it as “test.l”


In the command type ” flex test.” l and this will create a “lex.yy.c “ file. Open your MS Visual Studio and create a empty C++ project. Add the”lex.yy.c” file in the source folder.


Then in the project Tools\Options menu add the include file


In the “Project\sample Properties” select “Linker\Input” and in the “Additional Dependencies” put this “flexLib\libfl.a flexLib\liby.a” which means you put the libraries in your project under “flexLib” directory like below


Now, rebuild your solution and you should have no errors. That’s it!

Comments

Popular posts from this blog

Creating tray application and popup context menu in Windows

How to statically link applications to wxWidgets via Visual Studio 2008 and in Linux

How to put an image to wxPanel using wxWidgets