KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am learning to use getline in C programming and tried the codes from http://crasseux.com/books/ctutorial/getline.html #include <stdio.h> #include <stdlib.h> #include <string.h> 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; } However, the problem is that the compiler keeps returning errors of this: undefined reference to 'getline' . Could you please tell me what the problem is? Thank you! I am using Win7 64bit + Eclipse Indigo + MinGW
Tags (comma-separated)
Save Edits
Cancel