c - conflicting types for getline function -
i have function getline function in code block.but while compiling make file following error:
cc -dmain -c -o terp.o terp.c terp.c:130:15: error: conflicting types ‘getline’ in file included terp.c:2:0: /usr/include/stdio.h:675:20: note: previous declaration of ‘getline’ here make: *** [terp.o] error 1
the part terp.c around 130:
private char *getline() { static int first_time_called=1; if(!first_time_called) return 0; first_time_called=0; return expr; }
there @ least 3 possible solutions.
as
getline()
not in standard c library, in posix (and glibc), there switch disable extension (they enabled default in gcc). try compiling source commandcc -dmain -std=c99 -c -o terp.o terp.c
.if need posix extensions, have rename
getline()
function else.remove
#include <stdio.h>
source, error message disappear. may become confused if posix'sgetline()
used in source code, replaced yours.
Comments
Post a Comment