【发布时间】:2014-12-11 22:18:57
【问题描述】:
我已经解决这个问题一段时间了,我需要一点帮助:
制作这个程序的必要步骤是:
编译cpp2html.c生成cpp2html.o。 (重要提示:本项目源代码是C,不是C++,所以必须用gcc编译链接,而不是g++。)
运行命令
flex cppscanner.l
从 cppscanner.l 中的语言描述生成文件 lex.yy.c。
编译 lex.yy.c 以生成 lex.yy.o。 (这通常会产生有关额外令牌的警告消息。忽略它。)
链接 .o 文件以生成名为 cpp2html 的可执行程序
编写一个执行这些步骤的生成文件。当更改此过程的任何输入文件时,您的 makefile 应该只产生所需的最少步骤。
这些是我在编译时得到的错误/警告,
gcc: warning: cpp2html.o: linker input file unused because linking not done
gcc: warning; lex.yy.o: linker input file unused because linking not done
mv: cannot stat `a.out': No such file or directory
这是我的 makefile 中的内容:
enter code here
#
CPPFLAGS=-g -DDEBUG
#
#
cpps2html: cpp2html.o lex.yy.o
gcc $(CPPFLAGS) -c cpp2thml.o lex.yy.o
mv a.out cpp2html
cpp2thml.o: cpp2html.c
gcc &(CPPFLAGS) -c cpp2html.c
lex.yy.c: cppscanner.l
flex cppscaner.l
lex.yy.o: lex.yy.c
gcc $(CPPFLAGS) -c lex.yy.c
【问题讨论】: