UNIX環境高級編程源代碼編譯報錯barrier.c:(.text+0x80): undefined reference to `heapsort'

開發環境:CentOS-7.7-1908,gcc version 4.8.5 20150623

UNIX高級環境編程的源代碼下載地址:http://apuebook.com/code3e.html

源代碼壓縮包:src.3e.tar.gz

在CentOS-7.7下解壓源代碼文件後進行編譯,報錯信息爲:

gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  barrier.c -o barrier  -L../lib -lapue -pthread -lrt -lbsd
/tmp/cc6Z8vzR.o: In function `thr_fn':
barrier.c:(.text+0x80): undefined reference to `heapsort'
collect2: error: ld returned 1 exit status
make[1]: *** [barrier] Error 1

發現heapsort在CentOS-7下沒有相關的庫,只能下載Fedora的資源進行安裝。

然後執行

[root@localhost threads]# yum install libbsd libbsd-devel

即可編譯成功。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章