急!!!makefile

zscedu 2011-11-28 11:03:13
OPproxy.o: In function `main':
OPproxy.c:(.text+0x0): multiple definition of `main'
OPproxy.o:OPproxy.c:(.text+0x0): first defined here
OPproxy.o: In function `reaper':
OPproxy.c:(.text+0x786): multiple definition of `reaper'
OPproxy.o:OPproxy.c:(.text+0x786): first defined here
OPproxy.o: In function `OPproxy':
OPproxy.c:(.text+0x174): multiple definition of `OPproxy'
OPproxy.o:OPproxy.c:(.text+0x174): first defined here
OPproxy.o: In function `quitforpipe':


这些函数已经在OPproxy所包含的头文件中定义,怎么还会出这样的错误?求求大侠们,帮帮忙
...全文
286 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
zscedu 2011-11-29
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 keiy 的回复:]
我也是网上找的资料,最终他是通过升级gcc解决的
可以肯定的是这个是gcc的BUG
你也可以按上面的方法试试
因为gcc不同版本调用include时,可能会先从它自己定制的目录(如lib/gcc-x.xx/include)录而非/usr/include调用头文件的
再不行,将error.h中你用到的宏自己写个头文件
[/Quote]再帮我看看这个吧
In function 'DBopen':
DBfunc.c:102: warning: incompatible implicit declaration of built-in function ''
DBfunc.c: In function 'DBbind':
DBfunc.c:270: warning: incompatible implicit declaration of built-in function ''
DBfunc.c:285: warning: assignment makes pointer from integer without a cast
DBfunc.c:298: warning: assignment makes pointer from integer without a cast
这是什么原因引起的?怎么修改?
zscedu 2011-11-29
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cfjtaishan 的回复:]
重复定义了:不知道你的makefile是如何写的,在同目录下的源文件中有多个main函数。你的makefile可以写成可编译多个源文件中具有多个main函数的。需要你改一下。
[/Quote]帮我看看如果出现这样的错误怎么修改吧?
In function 'DBopen':
DBfunc.c:102: warning: incompatible implicit declaration of built-in function ''
DBfunc.c: In function 'DBbind':
DBfunc.c:270: warning: incompatible implicit declaration of built-in function ''
DBfunc.c:285: warning: assignment makes pointer from integer without a cast
DBfunc.c:298: warning: assignment makes pointer from integer without a cast
zscedu 2011-11-29
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 xiaoming880828 的回复:]
定义头文件的时候,应该尽量用#ifdef#endif等,免得出现头文件间接引用,造成你这样的问题
[/Quote]In function 'DBopen':
DBfunc.c:102: warning: incompatible implicit declaration of built-in function ''
DBfunc.c: In function 'DBbind':
DBfunc.c:270: warning: incompatible implicit declaration of built-in function ''
DBfunc.c:285: warning: assignment makes pointer from integer without a cast
DBfunc.c:298: warning: assignment makes pointer from integer without a cast
。。。。。。
现在又成这样的了,必要的头文件都包括了。。。。。。纠结呀
xiaoming880828 2011-11-29
  • 打赏
  • 举报
回复
定义头文件的时候,应该尽量用#ifdef#endif等,免得出现头文件间接引用,造成你这样的问题
zscedu 2011-11-29
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 keiy 的回复:]
我也是网上找的资料,最终他是通过升级gcc解决的
可以肯定的是这个是gcc的BUG
你也可以按上面的方法试试
因为gcc不同版本调用include时,可能会先从它自己定制的目录(如lib/gcc-x.xx/include)录而非/usr/include调用头文件的
再不行,将error.h中你用到的宏自己写个头文件
[/Quote]关键是我不知道这些宏(EINTR和EWOULDBLOCK)的值是多少
柯本 2011-11-28
  • 打赏
  • 举报
回复
两个解决方案:
1.更新你的gcc版本(这个是gcc的问题)
2.将程序中的#include <error.h>去掉,自己定义一个int errno;
zscedu 2011-11-28
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cfjtaishan 的回复:]
重复定义了:不知道你的makefile是如何写的,在同目录下的源文件中有多个main函数。你的makefile可以写成可编译多个源文件中具有多个main函数的。需要你改一下。
[/Quote]我把makefile修改了一下,好像可以编译了,但最后报一个这样的错误
/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches no
/lib/libc.so.6: could not read symbols: Bad value
自信男孩 2011-11-28
  • 打赏
  • 举报
回复
重复定义了:不知道你的makefile是如何写的,在同目录下的源文件中有多个main函数。你的makefile可以写成可编译多个源文件中具有多个main函数的。需要你改一下。
lancerEx 2011-11-28
  • 打赏
  • 举报
回复
头文件路径没包含进去
加上编译选项 -I+头文件目录
假如在当前目录有如下目录 include src
那么加上 -I./include
wzl9030 2011-11-28
  • 打赏
  • 举报
回复
这是重复定义吧
柯本 2011-11-28
  • 打赏
  • 举报
回复
我也是网上找的资料,最终他是通过升级gcc解决的
可以肯定的是这个是gcc的BUG
你也可以按上面的方法试试
因为gcc不同版本调用include时,可能会先从它自己定制的目录(如lib/gcc-x.xx/include)录而非/usr/include调用头文件的
再不行,将error.h中你用到的宏自己写个头文件
zscedu 2011-11-28
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 keiy 的回复:]
当你得到如下错误信息:
/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches
non-TLS reference in [...]
你可以这样做:
打开合适的makefile,找到DEFAULT_INCLUDES,在它的后面加
-include/usr/include/errno.h
……
[/Quote]我看了,gcc的版本好像是4.1.2
柯本 2011-11-28
  • 打赏
  • 举报
回复
当你得到如下错误信息:
/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches
non-TLS reference in [...]
你可以这样做:
打开合适的makefile,找到DEFAULT_INCLUDES,在它的后面加
-include/usr/include/errno.h
这个是在gcc-3.3.6中出现的
在CFLAGS后边加
-include/usr/include/errno.h
也可以

所以最好的方案是升级gcc
zscedu 2011-11-28
  • 打赏
  • 举报
回复
我从网上找到一个这样的方法
“If you get an error such as this:
/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches
non-TLS reference in [...]
What you need to do is this: open the appropriate makefile (i.e. in
TKIGES), find the line DEFAULT_INCLUDES, and add -include
/usr/include/errno.h to the end.
This applies to gcc-3.3.6, at least.
在CFLAGS后边加-include
/usr/include/errno.h也可以”
谁能解释一下这是什么意思呀?
zscedu 2011-11-28
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 keiy 的回复:]
两个解决方案:
1.更新你的gcc版本(这个是gcc的问题)
2.将程序中的#include <error.h>去掉,自己定义一个int errno;
[/Quote]那程序当中有涉及到EINTR和EWOULDBLOCK这些应该用什么值代替?

70,020

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧