C Ubuntu上的makefile出现问题
我试图安装一个程序,其中包含一个文件夹和一些C文件。我运行makefile,但出现以下错误:C Ubuntu上的makefile出现问题,c,ubuntu,makefile,C,Ubuntu,Makefile,我试图安装一个程序,其中包含一个文件夹和一些C文件。我运行makefile,但出现以下错误: /home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1128: undefined reference to `tgoto' /home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1129: undefined reference to `tputs' /home/silviu/
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1128: undefined reference to `tgoto'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1129: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1138: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1145: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1154: undefined reference to `tputs'
readline/libreadline.a(display.o): In function `delete_chars':
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1182: undefined reference to `tgoto'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1183: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1189: undefined reference to `tputs'
readline/libreadline.a(signals.o): In function `cr':
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/signals.c:301: undefined reference to `tputs'
collect2: error: ld returned 1 exit status
你知道我怎么解决吗?(在Ubuntu上)您在c程序中使用了
tputs
,因此您必须使用\include
和\include
。未定义的引用是链接器错误。编译c程序时,应在Makefile中链接-lcurses
或-lncurses
。在Makefile中添加类似的行。使用适当的链接库编译
比如说
gcc file.c -o output_file -lcurses -ltermcap
或
您是否安装了
curses
库?程序是否包含configure
script?@EugeneSh。我使用了./configure来获取makefile。如何安装curses库?sudo apt get install libncurses5 dev
。并阅读程序的文档(如果有)了解其他依赖项。您应该链接一些库。使用这些参数编译-ltermcap-lncurses
。如果它通过configure
,则所需的libs应该是正常的。。除非它警告过你。我必须在-lncurses
之外添加-ltermcap
,以解决tputs引用问题。
gcc file.c -o output_file -lcurses -ltermcap