“制作:*** 没有制作目标的规则 'all' Eclipse 错误

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

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

我 运行 在 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'

为什么?谁能帮帮我?

谢谢

您的 Makefile 中没有 all 目标。

选项 1

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

all: $(EXECUTABLE)

选项 2

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