Skip to main content

Thread: empty.c:(.text+0x10f8): undefined reference to `openpty'


i'm trying compile c language program ... 'empty' ... ld complains cannot find 'openpty' or 'login_tty'. here's full return ....

jfl@ws7:~/downloads/empty-0.6.18b$ make
gcc -wall -lutil -o empty empty.c
/tmp/ccg9pzwz.o: in function `main':
empty.c:(.text+0x10f8): undefined reference `openpty'
empty.c:(.text+0x118e): undefined reference `login_tty'
collect2: ld returned 1 exit status
make: *** [all] error 1

googling whereabouts of functions leads me believe in /usr/lib/libutil.so.

system ... 11.10 ... has no such library, explains why cannot compile program.

cannot find libutil package 11.10.

'openpty' , 'login_tty' found on ubuntu 11.10?

thanks.

try moving '-lutil' after 'empty.c' on gcc command line

it makes difference in command write option; linker searches , processes libraries , object files in order specified. thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file foo.o before bar.o. if bar.o refers functions in ‘z’, functions may not loaded.
http://gcc.gnu.org/onlinedocs/gcc/link-options.html

in 12.04 libutil part of libc6-dev package - don't know 11.10, sorry


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Packaging and Compiling Programs empty.c:(.text+0x10f8): undefined reference to `openpty'


Ubuntu

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP