⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 using flex in vc++.htm

📁 lex的C++代码实现,比较好用
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0071)http://clemens.bytehammer.com/papers/FlexTutorial/flex-vs_tutorial.html -->
<HTML><HEAD><TITLE>Using Flex in VC++</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV align=center>
<H2>Using Flex in Visual Studio 6 (VC++)</H2>
<H2>&nbsp;</H2></DIV>
<DIV align=left></DIV>
<DIV align=left>
<P><I>This tutorial is for users who are already familiar with Visual Studio 
VC++ and flex.</I></P>
<OL>
  <LI>Create a new workspace and add your lex file (ie lexer.l)<BR><BR>
  <LI>Save the following files in the same directory as your workspace: <A 
  href="http://clemens.bytehammer.com/papers/FlexTutorial/flex.exe">flex.exe</A> 
  , <A 
  href="http://clemens.bytehammer.com/papers/FlexTutorial/libfl.lib">libfl.lib</A>, 
  <A 
  href="http://clemens.bytehammer.com/papers/FlexTutorial/libfl.a">libfl.a</A><BR><BR>
  <LI>Go to Project/Settings/ and select your project in the explorer window at 
  the left.<BR><BR>
  <LI>Select the Link tab. In the "Object/library modules" section, append 
  libfl.lib and libfl.a to the end of the list. <BR><BR>
  <LI>If your lex file reads input from the command line, (such as a filename 
  like inputfile.txt), then select the Debug tab and add the command line 
  parameters to the "Program Arguments" field.<BR><BR>
  <LI>Return to the left hand explorer window and expand your project. Select 
  your lex file (ie lexer.l)<BR><BR>
  <LI>Under the "General" tab, select Always use custom build step.<BR><BR>
  <LI>Under the "Custom Build" tab, place flex followed by the name of your 
  lexer file into the "Commands" box (ie flex lexer.l)<BR>Then place this text 
  into the "Outputs" box: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lex.yy.c<BR><BR>
  <LI>Build your project once (Control-F5). You should get the message "Cannot 
  execute program".<BR><BR>
  <LI>The previous step should create a file called lex.yy.c in your workspace 
  directory. Add this file to your project.<BR><BR>
  <LI>I suggest you add the input file (if your lex program requires one) to 
  your project as well so that you can easily edit it, but this is not 
  required.<BR><BR>
  <LI>If you get an error that looks something like: <BR><BR>lex.yy.obj : error 
  LNK2001: unresolved external symbol _yywrap<BR>Debug/compiler.exe : fatal 
  error LNK1120: 1 unresolved externals<BR><BR>This means you are not linking in 
  the library files correctly. Check step 2, 3, and 4 again.<BR><BR>
  <LI>The next time you build (Control-F5), your project should run. If it 
  doesn't, <A href="http://clemens.bytehammer.com/papers/html/contact.html">send 
  me a message</A> and I'll see if I can help. </LI></OL></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -