apue.h报错问题

时间:2020-11-27 08:38:29

下载apue.3e后进入make,提示错误如下:

collect2: error: ld returned  exit status
Makefile:: recipe for target 'badexit2' failed
make[]: *** [badexit2] Error
make[]: Leaving directory '/home/pi/Downloads/apue.3e/threads'
Makefile:: recipe for target 'all' failed
make: *** [all] Error

需要安装库:

sudo apt-get install libbsd-dev

然后:

cp ./include/apue.h /usr/include/  
cp ./lib/error.c /usr/include
cp ./lib/libapue.a /usr/local/lib/

在apue.h最后加一行代码

#include "error.c"