【问题标题】:linking not done issue in flexflex中的链接未完成问题
【发布时间】:2012-11-09 18:33:07
【问题描述】:

我正在尝试通过“cc -c -o”创建一个目标文件,但我得到以下语句,我应该怎么做才能解决这个问题,提前谢谢

~/hedor1>lex -t example.l > example.c
~/hedor1>cc -c -o example.o example.l
cc: example.l: linker input file unused because linking not done

生成 example.c 的第一行正在运行,我得到了 .c 文件,但是当我编写第二行时,我得到了上面的内容!

【问题讨论】:

  • 编译 .c 文件,而不是 lex 源代码!
  • 如果将此代码存储在文件 count.l 中,则可以通过 lex -t count.l > count.c cc -c -o count.o count.l cc 从中构建可执行文件-o counter count.o -ll
  • 它应该像我做过一次但之后它只是显示上面的那样完成

标签: c compiler-construction compilation compiler-errors flex-lexer


【解决方案1】:

您将 flex 源代码传递给编译器,编译器显然将其解释为链接器输入文件,并抱怨因为您告诉编译器不要执行链接步骤。

第二个命令应该是:

cc -c -o example.o example.c

【讨论】:

  • 但我之前做了什么让他不再那样做并显示上面的信息?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多