Building Flex for/with Microsoft Visual C++ 6.0 and .Net

Yusuf Motiwala < yusuf@motiwala.org >

Building flex on MSVC does not require any code changes. You only require proper project/workspace files [Download, ~10KB]

  1.  Download latest flex distribution from here or any other gnu mirror
  2. untar/unzip flex distribution. say in f:\flex-2.5.4
  3. download MSVC project file flexmsvc.zip  [Download, ~10KB]
  4. unzip flexmsvc.zip into f:\flex-2.5.4\MISC directory.
  5. A new directory MSVC will be cerated in f:\flex-2.5.4\MISC directory. Your directory structure should now look like following

            Flex-2.5.4\MISC\MSVC\

                -Flex 

                -Flexlib

                -InitScan

                -TestProject

  1. Open msvc.dsw in directory MSVC using Visual C++
  2. Build [from build menu or right click flex workspace and select build]. This will build flex.exe, flexlib.lib, and initscan.exe. Ignore initscan.exe
  3. Build process will create new directory name 'Bin\Release' in Flex-2.5.4\MISC\MSVC\. This directory will contains flex.exe and flexlib.lib

    Test your build by opening TestProject.dsw in MISC/MSVC\TestProject directory. It compiles sample lex file and generates a win32 console application

Using Flex with Microsoft Visual C++ 6.0 and .Net

You need to setup custom build rules to compile your lex files. See TestProject in MISC\MSVC\TestProject directory [right click on example.l, ->Settings]. It compiles sample lex file and generates a win32 console application

I also made a test application which integrates flex with MSVC. Send me an e-mail and I will send you details.

Problem??

Write me and I will try to help you as far as I can.

==================================================================================================

Yusuf Motiwala < yusuf@motiwala.org >

http://www.geocities.com/ymotiwala//flex.html