我有一个C程序,我可以使用Code Block(我认为使用GCC编译器)在Windows上编译,在Linux上使用终端gcc编译器编译。我尝试使用eclipse,mac代码块,终端gcc甚至Qt在OSX上编译它,但它们都给了我同样的错误集:
hw1.c:9:19: error: conflicting types for 'mergesort'
struct listnode * mergesort(struct listnode *data)
^
/usr/include/stdlib.h:281:6: note: previous declaration is here
int mergesort(void *, size_t, size_t,
^
hw1.c:27:25: error: too few arguments to function call, expected 4, have 1
ahead = mergesort(ahead);
~~~~~~~~~ ^
/usr/include/stdlib.h:281:1: note: 'mergesort' declared here
int mergesort(void *, size_t, size_t,
^
hw1.c:28:25: error: too few arguments to function call, expected 4, have 1
bhead = mergesort(bhead);
~~~~~~~~~ ^
/usr/include/stdlib.h:281:1: note: 'mergesort' declared here
int mergesort(void *, size_t, size_t,
^
hw1.c:68:25: error: too few arguments to function call, expected 4, have 1
node = mergesort(node);
~~~~~~~~~ ^
/usr/include/stdlib.h:281:1: note: 'mergesort' declared here
int mergesort(void *, size_t, size_t,
^
答案 0 :(得分:1)
很可能是由于git。
OS X上的stdlib.h 已经有一个名为mergesort的方法,因此您不能在代码中声明该方法。
我建议将mergesort
的名称更改为其他名称,例如myMergesort
(或该行的某些内容)。
来源: See here.