conflicting types for getline function

前端 未结 2 2085
误落风尘
误落风尘 2021-01-25 23:13

I have a function for getline function in my code block.But while compiling the make file i get the following error:

cc -DMAIN   -c -o terp.o terp.c
terp.c:130:1         


        
2条回答
  •  伪装坚强ぢ
    2021-01-25 23:57

    There are at least three possible solutions.

    1. As getline() is not in standard c library, but in POSIX (and GLIBC), there could be switch to disable its extension (they enabled by default in GCC). Try compiling your source with command cc -DMAIN -std=c99 -c -o terp.o terp.c.

    2. If you need POSIX extensions, you have to rename your getline() function to something else.

    3. Remove #include from your source, this error message will disappear. But you may become confused if POSIX's getline() is used in your source code, as it will be replaced by yours.

提交回复
热议问题