Spec2006 编译错误 md5sum.c: conflicting types for 'getline'

来源:互联网 发布:淘宝经常给差评会怎样 编辑:程序博客网 时间:2024/05/16 08:35

参考:getline conflicting

问题来源: spec2006 编译的过程中出现如下错误

In file included from md5sum.c:38:0:lib/getline.h:31:1: error: conflicting types for 'getline'/usr/include/stdio.h:675:20: note: previous declaration of 'getline' was herelib/getline.h:34:1: error: conflicting types for 'getdelim'/usr/include/stdio.h:665:20: note: previous declaration of 'getdelim' was here

解决方法: 出现这个错误主要是由于stdio.h库已经定义getline和getdelim函数,而spec中的getline.h中也定义了该函数,从而造成冲突。

现在只需要将getline.h和getline.c中所有的getline和getdelim函数更改为自定的函数名称即可,例如get_line(…)和getdelim(…)等。

0 0
原创粉丝点击