聘我网

新概念招聘3.0

readline编译出错

vote up0vote downstar

readline.c:

#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>

int main(int argc, char *argv[]){
    readline("console>>");
    return 0;
}

一开始编译没有-lreadline,结果出现undefined reference to 'readline'

但加上了以后还是报错:

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `PC'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetflag'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetent'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `UP'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tputs'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgoto'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetnum'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `BC'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetstr'

到底怎样才能顺利编译readline?

 

2 个答复

vote up0vote downcheck

还需要-lncurses

链接
vote up0vote down

You have shed a ray of sunhsnie into the forum. Thanks!

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.