在 Linux Mint 中运行 lex 程序

发布于 2024-12-08 12:39:22 字数 190 浏览 5 评论 0原文

我正在尝试在 linux mint 中运行 lex 程序。我将该文件保存为 abc.l,现在我尝试通过键入以下命令在终端中编译该文件:

vi abc.l

lex abc.l

gcc lex.yy .c -lfl

但在最后一个命令之后它说没有这样的文件或目录。

请帮助我运行该程序。

I am trying to run a lex program in linux mint.I saved that file as abc.l,now i am trying to compile this file in the terminal by typing the following commands:

vi abc.l

lex abc.l

gcc lex.yy.c -lfl

but after the last command it is saying that no such file or directory.

please help me out in running the program.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回眸一笑 2024-12-15 12:39:22

首先,通过执行“man lex”检查您的系统上是否安装了 Lex。
如果没有安装,则需要安装Lex & Yacc 工具通过在命令提示符中键入这些

$sudo apt-get install flex
$sudo apt-get install bison

来编译尝试此命令,

$ cc -w lex.yy.c -ll

然后运行实际的程序,键入

$./a.out

First of all check if you have installed Lex on your system by doing a "man lex" .
If not installed,you need to install Lex & Yacc tools by typing these in the command prompt

$sudo apt-get install flex
$sudo apt-get install bison

For compiling try this command,

$ cc -w lex.yy.c -ll

Then to run the actual program,type

$./a.out
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文