linux - UNP源码编译出错,不明所以
天蓬老师
天蓬老师 2017-04-17 11:20:12
0
1
195

系统:Ubuntu 12.10 GCC: gcc 4.7.2 Glibc:2.15

编译/unpv13e/lib/wrapsock.c时发生如下错误

gcc -Wall -c wrapsock.c -o wrapsock.o
wrapsock.c: 在函数‘Inet6rthspace’中: wrapsock.c:82:2: 警告: 隐式声明函数‘inet6rthspace’ [-Wimplicit-function-declaration]
wrapsock.c: 在函数‘Inet6rthinit’中: wrapsock.c:94:2: 警告: 隐式声明函数‘inet6rthinit’ [-Wimplicit-function-declaration]
wrapsock.c:94:6: 警告: 赋值时将整数赋给指针,未作类型转换 [默认启用]
wrapsock.c: 在函数‘Inet6rthadd’中: wrapsock.c:104:2: 警告: 隐式声明函数‘inet6rthadd’ [-Wimplicit-function-declaration]
wrapsock.c: 在函数‘Inet6rthreverse’中: wrapsock.c:111:2: 警告: 隐式声明函数‘inet6rthreverse’ [-Wimplicit-function-declaration]
wrapsock.c: 在函数‘Inet6rthsegments’中: wrapsock.c:120:2: 警告: 隐式声明函数‘inet6rthsegments’ [-Wimplicit-function-declaration]
wrapsock.c: 在函数‘Inet6rthgetaddr’中: wrapsock.c:132:2: 警告: 隐式声明函数‘inet6rthgetaddr’ [-Wimplicit-function-declaration]
wrapsock.c:132:6: 警告: 赋值时将整数赋给指针,未作类型转换 [默认启用]

可是在 unp.h中明确包含了了
在netinet/in.h中找到如下
576 extern socklent inet6rthspace (inttype, int __segments) __THROW;
577 extern void *inet6_rth_init (void *
bp, socklen
tbplen, int __type,
579 extern int inet6
rth_add (void *
bp,const struct in6_addr *addr)THROW;
580 extern int inet6rthreverse (
const void *in, void *out)THROW;
581 extern int inet6rthsegments (
const void *bp) __THROW;
582 extern struct in6addr *inet6rth_getaddr (
const void *__bp, int __index)

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

membalas semua (1)
左手右手慢动作

netinet/in.h里,在定义ipv6相关function的prototype前,有个#ifdef __USE_GNU。而这个是由#ifdef _GNU_SOURCE控制的。所以你需要在unp.h里加入#define _GNU_SOURCE,就可以了。

    Muat turun terkini
    Lagi>
    kesan web
    Kod sumber laman web
    Bahan laman web
    Templat hujung hadapan
    Tentang kita Penafian Sitemap
    Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!