【问题标题】:"make: *** no rule to make target 'all' Eclipse Error"make: *** no rule to make target 'all' Eclipse 错误
【发布时间】:2016-08-05 01:18:44
【问题描述】:

我已经阅读了很多关于这个问题的帖子,但我无法解决它。

我在 Linux 上运行,安装了 Eclipse 和 CDT 插件。 我有一个现有的 C 项目,位于 /home/luca/prova。 在这个文件夹中有一些源文件和一个makefile(称为makefile),我在下面报告:

CC = gcc
CFLAGS = -Wall -Werror -O2
HEADERS = lz78_compressor.h lz78_decompressor.h 
SOURCES := $(wildcard *.c)
OBJ = $(SOURCES:.c=.o)
EXECUTABLE = lz78


.PHONY : clean install uninstall help


%.o : %.c $(HEADERS)
    @$(CC) -c -o $@ $< $(CFLAGS)


$(EXECUTABLE) : $(OBJ)
    $(CC) -o $@ $^ $(CFLAGS)
    @echo "Build finished. Executable file created : $(EXECUTABLE)"

clean : 
    rm -f $(EXECUTABLE) $(OBJ)


install :
    -@cp ./$(EXECUTABLE) /usr/bin
    @echo "Tool installed"


uninstall :
    -@rm /usr/bin/$(EXECUTABLE)
    @echo "Tool uninstalled"


help :
    @echo
    @echo "Makefile"
    @echo
    @echo "make                     : build all"
    @echo "install          : install the tool in the system"
    @echo "uninstall        : remove the tool from the system"
    @echo "clean            : remove all .o files and the executable file"
    @echo 

如果我在 shell 中编译,一切正常。但我想在 Eclipse 中导入它。 关注此 wiki,http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fgetting_started%2Fcdt_w_import.htm 我创建了一个新的 C 项目,然后我修改了有关项目构建的设置。 在下一张图片中有我设置的设置:

当我尝试构建项目时,我看到了错误

"make: *** no rule to make target 'all'

为什么?谁能帮帮我?

谢谢

【问题讨论】:

    标签: eclipse makefile eclipse-plugin eclipse-cdt


    【解决方案1】:

    您的 Makefile 中没有 all 目标。

    选项 1

    尝试将此添加为一行,以告诉 make 在make all 完成后要做什么:

    all: $(EXECUTABLE)
    

    选项 2

    您可以在 Eclipse CDT 中使用 Make Target View 添加额外的 Make 规则。

    【讨论】:

    • 谢谢,我使用您的选项 1 解决了:现在使用 Eclipse 我可以正确编译。但是从shell使用make all,我看到了这个错误,为什么? lz78 make: lz78: Command not found make: *** [makefile:53: all] 错误 127
    • 请发布一个新问题(不要编辑这个问题),显示您的完整 makefile 以及您在 shell 中的输入和输出。
    猜你喜欢
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-19
    • 2013-02-02
    • 1970-01-01
    • 2019-09-15
    • 2015-06-19
    • 1970-01-01
    相关资源
    最近更新 更多