Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C Ubuntu上的makefile出现问题_C_Ubuntu_Makefile - Fatal编程技术网

C Ubuntu上的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/

我试图安装一个程序,其中包含一个文件夹和一些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/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