【发布时间】:2016-12-09 07:36:23
【问题描述】:
我的 C Makefile 有问题。
这是 bash 中 Makefile 的代码:
CC=gcc
CFLAGS=-g -Wall
CCLINK=$(CC)
OBJS=flight.o runway.o airport.o main.o
RM=rm -f
# Creating the executable (airport)
airport: $(OBJS)
$(CCLINK) -o airport $(OBJS)
# Creating object files using default rules
main.o: main.c airport.h ex2.h flight.h runway.h
airport.o: airport.c airport.h ex2.h flight.h runway.h
runway.o: runway.c runway.h ex2.h flight.h
flight.o: flight.c flight.h ex2.h
# Cleaning old files before new make
clean:
$(RM) airport *.o *.bak *~ "#"* core
当我制作文件时,它说:
make: `airport` is up to date.
之后 - 我可以在 bash 中调用“机场”,它可以让我按照我想要的方式输入一些输入。
但是-当我试图检查“机场”是否由以下人员编译时:
gcc -g -Wall -c airport
我收到一条错误消息:
gcc: airport: linker input file unused because linking not done
有人知道可能是什么问题吗?
谢谢! 加夫里尔。
【问题讨论】:
-
当我试图检查“机场”是否由以下人员编译时,是什么意思:?
-
嗯,你正在尝试编译你的可执行文件...
-
是的,尝试
gcc -g -Wall -c airport.c与 .c 此外,当您发出gcc命令时,根本不使用 makefile。所以这个问题实际上可能与制造无关。但我们都在某个时候开始学习这些东西。 make / gcc / ld 等等是有区别的。祝你编程好运! :) -
谢谢大家,我误会了:)