Reputation: 294
I have read many threads about this problem, but I was not able to solve it.
I'm running on Linux, with Eclipse and CDT plugin installed. I have an existing C project, located in /home/luca/prova. In this folder there are some source files and a makefile (called makefile), that I report below:
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
If I compile in the shell, it works all fine. But I want to import it in Eclipse. Following this wiki, http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fgetting_started%2Fcdt_w_import.htm I create a new C project, then I modify settings about the project building. In the next image there are the settings that I set:
When I try to build the project, I see the error
"make: *** no rule to make target 'all'
Why? Anyone could help me?
Thanks
Upvotes: 0
Views: 3336
Reputation: 7980
You don't have an all
target in your Makefile.
Try adding this as a line to tell make what to do when make all
is done:
all: $(EXECUTABLE)
You can add extra Make rules with the Make Target View in Eclipse CDT.
Upvotes: 2