readline AWOL?
Dog Walker
thudfoo at gmail.com
Tue Nov 18 05:05:50 PST 2008
On Mon, Nov 17, 2008 at 12:40 PM, Jorge Almeida <jjalmeida at gmail.com> wrote:
> Hello, C-wise people,
>
> Can someone understand this?
>
> $ cat readtest.c
> #include <stdio.h>
> #include <readline/history.h>
> #include <readline/readline.h>
> #define MAINPROMPT ">"
> int main(int argc, char *argv[])
> {
> char *lp;
> lp=readline(MAINPROMPT);
> return 0;
> }
> $ gcc readtest.c
> /tmp/cc88uLvp.o: In function `main':
> readtest.c:(.text+0x19): undefined reference to `readline'
> collect2: ld returned 1 exit status
> $ ls /usr/include/readline
> chardefs.h history.h keymaps.h readline.h rlconf.h rlstdc.h
> rltypedefs.h tilde.h
>
> Tested in Gentoo and in FC5.
>
>> From man 3 readline:
>
> SYNOPSIS
> #include <stdio.h>
> #include <readline/readline.h>
> #include <readline/history.h>
>
> char *
> readline (const char *prompt);
>
>
I would try doing what it says, i.e., declaring the readline function
before you use it:
char *
readline (const char *prompt);
int main(int argc, char *argv[])
{
char *lp;
lp=readline(MAINPROMPT);
return 0;
}
>
>
> --
> Jorge Almeida
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: http://linux-sxs.org/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
>
--
I have seen the future and I'm not in it!
More information about the Linux-users
mailing list