我试图编译我已经从我的课本逐字复制的程序,但我得到了以下错误:C:GCC编译器冲突类型的错误
maxline.c:4:5: error: conflicting types for ‘getline’ /usr/include/stdio.h:675:20: note: previous declaration of ‘getline’ was here maxline.c:26:5: error: conflicting types for ‘getline’ /usr/include/stdio.h:675:20: note: previous declaration of ‘getline’ was here
这里是在线路问题:
4 int getline(char line[], int maxline);
26 int getline(char s[], int lim)
有没有什么东西难以置信地显而易见,我错过了?
为什么第4行和第26行对参数使用不同的名称?这不是非法的,但很奇怪。 –
请注意,您没有在'stdio.h'中发布decl,这是* real *冲突点。显然,你的* decl和实现应该相互匹配。警告告诉你'getline()'已经被声明,并且不符合*你的*代码(原型或定义)。看* * decl(在stdio.h,第675行)。 – WhozCraig
当我将“getline”的名称更改为“getln”时完美工作。非常感谢! – JazzBullets