【发布时间】:2016-01-14 16:42:35
【问题描述】:
我正在尝试在 ubuntu 中编写一个简单的 makefile。我的makefile如下所示。当我执行make 时,我得到标题中显示的链接器错误。谁能提供有关此错误的指导或告诉我是否有更好的方法?基本上我有几个.h和.c文件,需要编译执行。
CC=gcc
CFLAGS=-c -Wall
RM = @rm -f
DEPS = pub.h main.h common.h p_pub.h udp_pub.h
OBJ = opts.o pf_ctrl.o pf_recv.o pf_xmit.o
%.o: %.c $(DEPS)
$(CC) -c $@ $< $(CFLAGS)
hellomake: $(OBJ)
gcc -o $@ $^ $(CFLAGS)
clean: $(RM) $(OBJ)
【问题讨论】:
标签: c linux makefile linker-errors