undefined reference to `getline' in c

后端 未结 3 1766
情书的邮戳
情书的邮戳 2020-11-28 14:34

I am learning to use getline in C programming and tried the codes from http://crasseux.com/books/ctutorial/getline.html

#include 
#include <         


        
3条回答
  •  一生所求
    2020-11-28 15:07

    getline isn't a standard function, you need to set a feature test macro to use it, according to my man page,

    _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
    

    for glibc 2.10 or later,

    _GNU_SOURCE
    

    before that.

提交回复
热议问题