Tag: mingw32

c中对’getline’的未定义引用

我正在学习在C编程中使用getline,并尝试了http://crasseux.com/books/ctutorial/getline.html中的代码 #include #include #include int main(int atgc, char *argv[]) { int bytes_read = 1; int nbytes = 10; char *my_string; my_string = (char *)malloc(nbytes+1); puts(“Please enter a line of text”); bytes_read = getline(&my_string, &nbytes, stdin); if (bytes_read == -1) { puts (“ERROR!”); } else { puts (“You typed:”); puts (my_string); } return 0; } 但是,问题是编译器不断返回错误: […]