编译静态expect现undefined reference to `openpty' 错误解决方法

错误提示如下:

...

gcc \
-pipe -O2 -fomit-frame-pointer -Wall \
-Wl,--export-dynamic \
-o expect exp_main_exp.o \
-L/work/pkgs/expect5.45 -lexpect5.45 \
-L/work/pkgs/tcl8.5.9/unix -ltcl8.5 \
-ldl -lieee -lm \
-Wl,-rpath,/usr/local/lib \
-Wl,-rpath,/usr/local/lib/expect5.45
/work/pkgs/expect5.45/libexpect5.45.a(pty_termios.o): In function `exp_getptymaster':
pty_termios.c:(.text+0x2f5): undefined reference to `openpty'
collect2: ld returned 1 exit status
make: *** [expect] Error 1

解决方法:

添加util链接库 -lutil

你可能感兴趣的:(C++,c,unix,gcc,C#)