标签:
[root@localhost myunp2]# vim ftok.c [root@localhost myunp2]# gcc -o ftok ftok.c /tmp/ccxRydhw.o: In function `main‘: ftok.c:(.text+0x18): undefined reference to `err_quit‘ ftok.c:(.text+0x30): undefined reference to `Stat‘ ftok.c:(.text+0x48): undefined reference to `Ftok‘ collect2: 错误:ld 返回 1 [root@localhost myunp2]# gcc -o ftok ftok.c -lunpipc /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_open‘: wrapunix.c:(.text+0x4d8): undefined reference to `mq_open‘ wrapunix.c:(.text+0x4f0): undefined reference to `mq_open‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_close‘: wrapunix.c:(.text+0x52b): undefined reference to `mq_close‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_unlink‘: wrapunix.c:(.text+0x55b): undefined reference to `mq_unlink‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_send‘: wrapunix.c:(.text+0x5a3): undefined reference to `mq_send‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_receive‘: wrapunix.c:(.text+0x5e3): undefined reference to `mq_receive‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_notify‘: wrapunix.c:(.text+0x623): undefined reference to `mq_notify‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_getattr‘: wrapunix.c:(.text+0x653): undefined reference to `mq_getattr‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Mq_setattr‘: wrapunix.c:(.text+0x68b): undefined reference to `mq_setattr‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_open‘: wrapunix.c:(.text+0x9c8): undefined reference to `sem_open‘ wrapunix.c:(.text+0x9e0): undefined reference to `sem_open‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_close‘: wrapunix.c:(.text+0xa1b): undefined reference to `sem_close‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_unlink‘: wrapunix.c:(.text+0xa4b): undefined reference to `sem_unlink‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_init‘: wrapunix.c:(.text+0xa8b): undefined reference to `sem_init‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_destroy‘: wrapunix.c:(.text+0xabb): undefined reference to `sem_destroy‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_wait‘: wrapunix.c:(.text+0xaeb): undefined reference to `sem_wait‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_trywait‘: wrapunix.c:(.text+0xb1c): undefined reference to `sem_trywait‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_post‘: wrapunix.c:(.text+0xb5b): undefined reference to `sem_post‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Sem_getvalue‘: wrapunix.c:(.text+0xb93): undefined reference to `sem_getvalue‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Shm_open‘: wrapunix.c:(.text+0xccc): undefined reference to `shm_open‘ /usr/lib/libunpipc.a(wrapunix.o): In function `Shm_unlink‘: wrapunix.c:(.text+0xd0b): undefined reference to `shm_unlink‘ collect2: 错误:ld 返回 1 [root@localhost myunp2]# gcc -lrt -o ftok ftok.c -lunpipc [root@localhost myunp2]# man mq_open Cannot open the message catalog "man" for locale "zh_CN.UTF-8" (NLSPATH="/usr/share/locale/%l/LC_MESSAGES/%N") Formatting page, please wait...
出现上面的错误,使用gcc 加选项-lrt解决。
标签:
原文地址:http://www.cnblogs.com/wuchanming/p/4531979.html