C库编译错误

C库编译错误,c,compiler-construction,makefile,compiler-errors,C,Compiler Construction,Makefile,Compiler Errors,我正试图从中编译排序库 直接链接到图书馆: 当我运行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: ***

我正试图从中编译排序库

直接链接到图书馆:

当我运行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
有人能帮忙解决这个问题吗?

Frosty

嗯,编译器正在抱怨类型
heapsort
已经在
/usr/include/stdlib.h
301行定义了。。。处理这些问题的传统方法是:

  • 在代码中为有问题的文章使用另一个名称。有人认为,
    myheapsort
    应该做得很好。(是的,您可以修改
    sort all.tgz
    ,因为它是在GNU GPL下发布的)
  • superss stdlib使用#def#ifndef(如果您无法更改代码)定义的
    heapsort
  • 尖叫、哭泣、诅咒,并希望所有
    stdlib
    s(至少)在被创造的地方都是平等的。唉

希望能有所帮助。

看起来有两个文件试图定义
heapsort
谢谢!,我用了你的建议,把代码改成了myheapsort。