A: 

I'm not sure I've ever seen that specific definition of 'getline' here is the one I know of which uses c++ streams+strings.

http://www.cplusplus.com/reference/string/getline/

DeusAduro
+3  A: 

getline is defined in stdio.h in glibc version 2.10 and later, but not in earlier versions, nor (so far) in the BSD derived libc.

The change in the GNU libraries came about because of a change in the POSIX 2008 standard, which now includes getline.

Presumably, this will propogate to other libc over time. In the mean time, I understand that it is causing trouble for a lot of projects.

You can download a stand alone version from GNU.

dmckee
+1  A: 

Generally, the solution is to use autoconf or some similar tool to determine whether the current platform already has getline or not, and supply your own definition only when needed.

Example:

# configure.ac
AC_CHECK_FUNCS([getline])

// compat.h
#include "config.h"
#ifndef HAVE_GETLINE
ssize_t getline(char **lineptr, size_t *n, FILE *stream);
#endif

// getline.c
ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
    /* definition */
}

# Makefile.am
program_LDADD = $(if $(HAVE_GETLINE),,getline.o)

or something along those lines, you'll have to adjust it to match your own program.

ephemient