免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2736 | 回复: 1
打印 上一主题 下一主题

makefile链接出错 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-08 05:18 |只看该作者 |倒序浏览
CC = gcc
LIB=-I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
CL=`pkg-config --cflags --libs gtk+-2.0 gthread-2.0`
OBJ=main.o face.o callback.o init.o write.o read.o thread.o error.o
all: $(OBJ) ice.h
        $(CC) $(OBJ) -o ice $(LIB) $(CL)
main.o:main.c main.h thread.h face.h init.h read.h
        $(CC) -c -g -Wall main.c $(LIB) $(CL)
face.o:face.c face.h callback.h
        $(CC) -c -g -Wall face.c $(LIB) $(CL)
callback.o:callback.c callback.h write.h read.h thread.h
        $(CC) -c -g -Wall callback.c $(LIB) $(CL)
init.o: init.c init.h error.h thread.h read.h
        $(CC) -c -g -Wall init.c $(LIB) $(CL)
write.o:write.c write.h init.h thread.h error.h
        $(CC) -c -g -Wall write.c $(LIB) $(CL)
read.o:read.c init.h read.h thread.h write.h
        $(CC) -c -g -Wall read.c $(LIB) $(CL)
thread.o: thread.c thread.h read.h
        $(CC) -c -g -Wall thread.c $(LIB) $(CL)
error.o: error.c error.h
        $(CC) -c -g -Wall error.c $(LIB) $(CL)
clean:
        rm -f $(OBJ)
我觉得挺简单的,但是make 后,出险的错误如下:
face.o(.data+0x24): In function `u1_set_p1':
/root/face.c:10: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
face.o(.data+0x30): In function `u1_set_p1':
/root/face.c:11: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
callback.o(.data+0x24): In function `set_back':
/root/callback.c:9: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
callback.o(.data+0x30): In function `set_back':
/root/callback.c:9: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
init.o(.data+0x24): In function `my_connect':
/root/init.c:10: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
init.o(.data+0x30): In function `my_connect':
/root/init.c:10: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
write.o(.data+0x24): In function `writecom':
/root/write.c:12: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
write.o(.data+0x30): In function `writecom':
/root/write.c:15: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
read.o(.data+0x24): In function `CRC16':
/root/read.c:13: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
read.o(.data+0x30): In function `CRC16':
/root/read.c:15: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
thread.o(.data+0x24): In function `ShowValueS':
/root/thread.c:11: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
thread.o(.data+0x30): In function `ShowValueS':
/root/thread.c:11: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
error.o(.data+0x24): In function `on_message':
/root/error.c:12: multiple definition of `Addr6054'
main.o(.data+0x24):/root/main.c:14: first defined here
error.o(.data+0x30): In function `on_message':
/root/error.c:12: multiple definition of `Addr6063'
main.o(.data+0x30):/root/main.c:14: first defined here
collect2: ld returned 1 exit status
make: *** [all] Error 1
调了一天也没有调通,
在线等待,拜谢...

论坛徽章:
0
2 [报告]
发表于 2006-04-10 13:22 |只看该作者
谢谢版主,我的头文件没有EXTERN声明.变成了定义,才导致这种错误,实在不好意思,您的文章我看过了,比较棒的文章,深入浅出,以后有什么问题还要麻烦您啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP