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.

  1. as getline() not in standard c library, in posix (and glibc), there switch disable extension (they enabled default in gcc). try compiling source command cc -dmain -std=c99 -c -o terp.o terp.c.

  2. if need posix extensions, have rename getline() function else.

  3. remove #include <stdio.h> source, error message disappear. may become confused if posix's getline() used in source code, replaced yours.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -