hello, trying run c program using getline() , receiving following error message: code:
14:42@***:~/documents/c$ gcc -o 3n1 3n1.c undefined symbols: "_getline", referenced from: _main in ccmhb6eq.o ld: symbol(s) not found collect2: ld returned 1 exit status the program simple possible: code:
#include <stdio.h> main() { int x; char *line; x = getline(line,100,stdin); } i used definition getline() on site: https://wiki.cs.columbia.edu:8443/display/res/getline()+missing placed in getline.c file , included getline.c file in program , resulted in segmentation fault upon execution. can point me in right direction.
hello, trying run c program using getline() , receiving following error message:
code:
14:42@***:~/documents/c$ gcc -o 3n1 3n1.c undefined symbols: "_getline", referenced from: _main in ccmhb6eq.o ld: symbol(s) not found collect2: ld returned 1 exit status the program simple possible:
code:
#include <stdio.h> main() { int x; char *line; x = getline(line,100,stdin); } i used definition getline() on site:
https://wiki.cs.columbia.edu:8443/display/res/getline()+missing placed in getline.c file , included getline.c file in program , resulted in segmentation fault upon execution.
can point me in right direction.
click expand...
getline included in os x (at least in lion, page may have been 'the old days') terminal type 'man getline' code:
name getdelim, getline -- line stream library standard c library (libc, -lc) synopsis #include <stdio.h> ssize_t getdelim(char ** restrict linep, size_t * restrict linecapp, int delimiter, file * restrict stream); ssize_t getline(char ** restrict linep, size_t * restrict linecapp, file * restrict stream); examples following code fragment reads lines file , writes them standard output. fwrite() function used in case line contains embedded nul characters. char *line = null; size_t linecap = 0; ssize_t linelen; while ((linelen = getline(&line, &linecap, fp)) > 0) fwrite(line, linelen, 1, stdout); per man page, looks first 2 arguments function not right.
Forums Macs Mac Programming
iPhone Mac OS & System Software iPad Apple Watch Notebooks iTunes Apple ID iCloud Desktop Computers Apple Music Professional Applications iPod iWork Apple TV iLife Wireless
No comments:
Post a Comment