Hi all,
First time poster here, I've referenced posts here on daniweb in the past and it has always been helpful, thanks! But I can't find the answer to this particular problem here on the forums.
I need to write a basic string parser as part of a coding assignment here at penn state. I have completed the assignment using getc, but bonus points are offered for a solution using getline.
The getline() man page (http://linux.die.net/man/3/getline) requires stdio.h and stdlib.h for getline to compile.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
//welcome to main!
//we need our input values!
char inputstr[128];
while(1)
{
if(feof(stdin) != 0)
{ break; }
getline(&inputstr, 128, NULL);
//did that work!?
printf("input string is : %s\n", inputstr);
}
getc(stdin);
return 0;
}
This code wont even compile!!
Here is the compiler error and log, from Dev-C++(set for standard C)
LOG:
Compiler: Default compiler
Executing gcc.exe...
gcc.exe "E:\pr1\proj1.c" -o "E:\pr1\proj1.exe" -I"E:\Dev-Cpp\include" -L"E:\Dev-Cpp\lib"
C:\DOCUME~1\xxxxxx\LOCALS~1\Temp/ccwrbaaa.o(.text+0x61):proj1.c: undefined reference to `getline'
collect2: ld returned 1 exit status
Execution terminated
ERROR:
[Linker error] undefined reference to `getline'
ld returned 1 exit status
Unfortunately, my go-to book, C:ARM(C a reference manual) doesnt even have this function! :(
Thanks for any help or insight you can provide!
-Tav
EDIT:
I realize that getline is not a standard C function, but even when I compile using
-std=c99
I get the same error!