Lex - How to run / compile a lex program on commandline

痞子三分冷 提交于 2019-11-30 09:48:43

You first have to go to the directory which the file wordcount.l is in using cd. Then using lex wordcount.l will make the file lex.yy.c. To the run the program you need compile it with a c compiler such as gcc. With gcc you can compile it using gcc -lfl lex.yy.c. This will create a.out which can be run using ./a.out

lex file.l
gcc lex.yy.c -ly -ll
./a.out

These also works. I am using this in Ubuntu 14.04.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!