Why do I get a “conflicting types for getline” error when compiling the longest line example in chapter 1 of K&R2?

后端 未结 7 442
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 17:09

Here is a program I\'m trying to run straight from section 1.9 of \"The C Programming Language\".

#include 
#define MAXLINE 1000

int getline(         


        
7条回答
  •  [愿得一人]
    2020-12-04 17:23

    The problem is that getline() is a standard library function. (defined in stdio.h) Your function has the same name and is thus clashing with it.

    The solution is to simply change the name.

提交回复
热议问题