to install flex follow these steps
DESCRIPTION
To Install Flex Follow These StepsTRANSCRIPT
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 1
To install flex follow these steps: 1- Run the flex setup by clicking on the executable file:
2- The flex will be installed under a folder with a name GnuWin32 in the program files
3- Now go to the directory of the flex, the default is: C:\Program
Files\GnuWin32, u will find a folder named include, inside it u will find two c++ header files:
o flexlexer.h o unistd.h
Copy them to the Visual Studio directory: C:\Program Files\Microsoft Visual Studio 10\VC\include Do u remember openGL?? I do !!
4- Open the Visual Studio 2010, I assumed that u installed it, Choose: File new project:
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 2
U will get a window, choose visual c++, win32 console application and dont forget to add a name to ur project. See the next figure:
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 3
Press ok, u will get a wizard, just click finish
5- Now we want to add the lex to the visual studio: Choose: Tools external tools, u will get a window just like this:
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 4
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 5
6- Add a new tool, our flex tool:
tool FlexTool Fill the title field, I put it FlexTool, Fill the command field, give it the flex path: C:\Program Files\GnuWin32\bin, u will find two exe files, flex.exe flex++.exe
Choose flex.exe, Now fill the arguments field as:
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 6
And finally fill the Initial directory field:
Note: make sure do remove the check from the Close on exit Now u can click OK.
U will find a new line in the tools menu:
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 7
tools .
Now u have a new project, And u have ur lex file, just like the lex.l file, i gave it to u in the 2nd lecture, Copy ur lex file to the project directory I named my project as LexTestProject, so I should copy the lex.l to the project
Visual Studio : : Add new Filter
-
ytisrevinU etavirP kuomraY
& scitamrofnI fo ytlucaF gnireenignE noitacinummoC
8 egaP
xeL :
:
: l.xel eht esoohc meti gnitsixE ddA
-
Yarmouk Private University
Faculty of Informatics & Communication Engineering
Page 9
Now Dbl click on the lex.l, Then choose: Tools the new added tool, just like this pic
:
-
ytisrevinU etavirP kuomraY
& scitamrofnI fo ytlucaF gnireenignE noitacinummoC
egaP 01
XELF . ++c
l.xeL :
: >h.bildts< edulcni# ;maertsi ssalc >h.dtsinu< edulcni#
: >h.bildts< edulcni# >h.dtsinu< edulcni# >maertsoi< edulcni# ;dts ecapseman gnisu
nc.w@sawak .