【发布时间】:2016-12-24 19:09:09
【问题描述】:
我想在我从事套接字编程的项目中使用“Makefile”。我有两个简单的 .c 文件,但它们有自己的主要功能。由于这两个主要功能,makefile 会返回错误。
我在 server.c 文件中有一个 main 函数,在 client.c 中有一个 main 函数
错误
gcc server.o client.o -o output -lpthread client.o: 在函数中
main': client.c:(.text+0x0):main' için birden fazla tanım server.o:server.c:(.text+0x78): 类似 burada tanımlanmış collect2: 错误:ld 返回 1 退出状态 Makefile:4:目标配方 '输出'失败 make: *** [输出] 错误 1
制作文件
all: output
output: server.o client.o
gcc server.o client.o -o output -lpthread
server.o: server.c
gcc -c server.c
client.o: client.c
gcc -c client.c
clean:
rm *.o
谢谢:)
【问题讨论】: