I have this makefile:
CC=gcc
CFLAGS= -c -Wall -std=c99 -ggdb
all: plan
plan: plan.o graph.o
$(CC) $(CFLAGS) plan.o graph.o -o plan
plan.o: plan.c graph.h
$(CC) $(CFLAGS) plan.c
graph.o: graph.c graph.h
$(CC) $(CFLAGS) graph.c
run: all
./plan
when I run make, gcc give me the message "linker input file unused because linking not done", what does it mean by that?
The -c
option means:
Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
You should not use that option when building.
See gcc man
For the plan target, do not use the CFLAGS:
plan: plan.o graph.o
$(CC) -Wall -std=c99 -ggdb plan.o graph.o -o plan
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.