C 库编译错误
我正在尝试从 http://www.yendor.com/programming/sort/ 编译排序库
直接链接到库:http://www.yendor.com/programming/sort/sort-all.tgz
当我运行 make 时,编译器说:
gcc -g -O -DCUTOFF=15 -c sorttest.c
In file included from sorttest.c:15:
sort.h:66: error: conflicting types for ‘heapsort’
/usr/include/stdlib.h:301: error: previous declaration of ‘heapsort’ was here
make: *** [sorttest.o] Error 1
有人可以帮助解决这个问题吗?
I'm trying to compile the sorting library from http://www.yendor.com/programming/sort/
Direct Link to library: http://www.yendor.com/programming/sort/sort-all.tgz
When I run make the compiler says:
gcc -g -O -DCUTOFF=15 -c sorttest.c
In file included from sorttest.c:15:
sort.h:66: error: conflicting types for ‘heapsort’
/usr/include/stdlib.h:301: error: previous declaration of ‘heapsort’ was here
make: *** [sorttest.o] Error 1
Can someone help with this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Frosty,
好吧,编译器抱怨类型
heapsort
已经在/usr/include/stdlib.h
中的301
行定义了。处理这些问题的传统方法是:sort-all.tgz
,因为它是在 GNU GPL 下发布的)heapsort
的定义(如果您无法更改)你的代码)。希望有帮助。
Frosty,
Well, the compiler is complaining that the type
heapsort
is already defined at line301
in/usr/include/stdlib.h
... the traditional methods for dealing with these issues are :myheapsort
should do nicely. (and yes you can modifysort-all.tgz
, coz it's published under GNU GPL)heapsort
using #def #ifndef (if you can't change your code).stdlib
s (at least) where created equal. Sigh.Hope that helps.