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

参考: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 here
lib/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(…)等。

你可能感兴趣的:(gem5,gem5学习与分享)