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

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.

Leave a Comment