如何在Visual Studio 2005/2008中编译flex?

时间:2023-01-03 09:43:04

I can't figure this one out. I can download a win32 binary of flex 2.5.4a from gnuwin32, but I'd like to build the latest version (2.5.35) using Visual Studio 2005. I suppose I could build in in cygwin, but where is the fun in that?

我无法想象这一个。我可以从gnuwin32下载flex 2.5.4a的win32二进制文件,但我想使用Visual Studio 2005构建最新版本(2.5.35)。我想我可以在cygwin中构建,但是那里的乐趣在哪里?

4 个解决方案

#1


2  

Note that Flex is seriously out-of-date on Windows when it comes to generating C++ scanners. Recent Flex versions which are able to generate ISO C++ scanners do not support Win32 (MinGW or VS), so you're probably better of trying to generate a C scanner and call it from C++.

请注意,在生成C ++扫描程序时,Flex在Windows上严重过时了。最近能够生成ISO C ++扫描程序的Flex版本不支持Win32(MinGW或VS),因此您可能更好地尝试生成C扫描程序并从C ++调用它。

#2


1  

since nobody provided a satisfactory answer to my question, i am posting my final solution here.

由于没有人对我的问题提供满意的答案,我在这里发布我的最终解决方案。

i was unable to find a way to build flex in vs 2005 or vs 2008. instead, i am using the flex that is distributed with cygwin, which is pretty recent. in order to save myself the hassle of installing cygwin on every machine that i need to use flex on, i just saved off the dependencies: cygwin1.dll and cygintl-8.dll.

我无法找到在vs 2005或vs 2008中构建flex的方法。相反,我使用的是与cygwin一起分发的flex,这是最近的。为了节省自己在我需要使用flex的每台机器上安装cygwin的麻烦,我只是保存了依赖项:cygwin1.dll和cygintl-8.dll。

there is only one caveat - cygwin's flex also depends on m4, though you won't see it on the dependency walker. it needs to be in the path, which makes it a pain. you can use cygwin's m4.exe, but it depends on cygwin1.dll also, which will need to be in the path for m4 to execute.

只有一个警告 - cygwin的flex也取决于m4,尽管你不会在依赖步行器上看到它。它需要在路径中,这使它成为一种痛苦。你可以使用cygwin的m4.exe,但它也依赖于cygwin1.dll,它需要在m4的路径中执行。

even so, i just check all of those files into my svn under a tools folder and then whenever i need to develop on another machine, get my code and flex with svn, copy m4.exe and cygwin1.dll to the windows\system32 folder, and i'm in business.

即便如此,我只是在工具文件夹下检查所有这些文件到我的svn然后每当我需要在另一台机器上开发时,使用svn获取我的代码和flex,将m4.exe和cygwin1.dll复制到windows \ system32文件夹,我在做生意。

#3


1  

You can also download the MINGW (Minimalist GNU for Windows) build of flex 2.5.35 at sourceforge.net. This build may not be entirely self-contained; the release notes suggest that certain components of MSYS (Minimal SYSytem) are required.

您还可以在sourceforge.net下载Flex 2.5.35的MINGW(Minimalist GNU for Windows)版本。这种构建可能不是完全独立的;发行说明表明需要MSYS(Minimal SYSytem)的某些组件。

#4


0  

Why you don't want to try the Spirit framework from Boost?

为什么你不想尝试Boost中的Spirit框架?

#1


2  

Note that Flex is seriously out-of-date on Windows when it comes to generating C++ scanners. Recent Flex versions which are able to generate ISO C++ scanners do not support Win32 (MinGW or VS), so you're probably better of trying to generate a C scanner and call it from C++.

请注意,在生成C ++扫描程序时,Flex在Windows上严重过时了。最近能够生成ISO C ++扫描程序的Flex版本不支持Win32(MinGW或VS),因此您可能更好地尝试生成C扫描程序并从C ++调用它。

#2


1  

since nobody provided a satisfactory answer to my question, i am posting my final solution here.

由于没有人对我的问题提供满意的答案,我在这里发布我的最终解决方案。

i was unable to find a way to build flex in vs 2005 or vs 2008. instead, i am using the flex that is distributed with cygwin, which is pretty recent. in order to save myself the hassle of installing cygwin on every machine that i need to use flex on, i just saved off the dependencies: cygwin1.dll and cygintl-8.dll.

我无法找到在vs 2005或vs 2008中构建flex的方法。相反,我使用的是与cygwin一起分发的flex,这是最近的。为了节省自己在我需要使用flex的每台机器上安装cygwin的麻烦,我只是保存了依赖项:cygwin1.dll和cygintl-8.dll。

there is only one caveat - cygwin's flex also depends on m4, though you won't see it on the dependency walker. it needs to be in the path, which makes it a pain. you can use cygwin's m4.exe, but it depends on cygwin1.dll also, which will need to be in the path for m4 to execute.

只有一个警告 - cygwin的flex也取决于m4,尽管你不会在依赖步行器上看到它。它需要在路径中,这使它成为一种痛苦。你可以使用cygwin的m4.exe,但它也依赖于cygwin1.dll,它需要在m4的路径中执行。

even so, i just check all of those files into my svn under a tools folder and then whenever i need to develop on another machine, get my code and flex with svn, copy m4.exe and cygwin1.dll to the windows\system32 folder, and i'm in business.

即便如此,我只是在工具文件夹下检查所有这些文件到我的svn然后每当我需要在另一台机器上开发时,使用svn获取我的代码和flex,将m4.exe和cygwin1.dll复制到windows \ system32文件夹,我在做生意。

#3


1  

You can also download the MINGW (Minimalist GNU for Windows) build of flex 2.5.35 at sourceforge.net. This build may not be entirely self-contained; the release notes suggest that certain components of MSYS (Minimal SYSytem) are required.

您还可以在sourceforge.net下载Flex 2.5.35的MINGW(Minimalist GNU for Windows)版本。这种构建可能不是完全独立的;发行说明表明需要MSYS(Minimal SYSytem)的某些组件。

#4


0  

Why you don't want to try the Spirit framework from Boost?

为什么你不想尝试Boost中的Spirit框架?