当前位置: 技术问答>linux和unix
`socklen_t' has not been declared
来源: 互联网 发布时间:2017-03-14
本文导语: 我在SunOS上编译一个东西,出现下面的错误: In file included from /data03/OBGRP/ob60/ob_rel/include/public/common/base/base_func.h:23, from /data03/OBGRP/ob60/ob_rel/include/public/common/sdlbuffer/sdl_basic_objs.h:19, ...
我在SunOS上编译一个东西,出现下面的错误:
In file included from /data03/OBGRP/ob60/ob_rel/include/public/common/base/base_func.h:23,
from /data03/OBGRP/ob60/ob_rel/include/public/common/sdlbuffer/sdl_basic_objs.h:19,
from /data01/JFGRP/wangyl11/work/openbilling60/mediation/codec/sdl/codec_sdl_c.h:16,
from ../src/realtime.h:5,
from ../src/socket_for_tcpserver.cpp:10:
/usr/include/arpa/inet.h:69: error: `socklen_t' has not been declared
/usr/include/arpa/inet.h:72: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:74: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:75: error: variable `in_addr inet_makeaddr' has initializer but incomplete type
/usr/include/arpa/inet.h:75: error: `in_addr_t' was not declared in this scope
/usr/include/arpa/inet.h:75: error: `in_addr_t' was not declared in this scope
/usr/include/arpa/inet.h:76: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:77: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:75: error: storage size of `inet_makeaddr' isn't known
上面的说未定义的都可以在/usr/include/netinet/in.h中找到,其中socklen_t在两个文件中定义过:netinet/in.h和sys/socket.h;
在netinet/in.h中有如下的描述:
/*
* The socklen definitions are reproduced here from sys/socket.h so as to
* not introduce that namespace into existing users of netinet/in.h.
*/
在sys/socket.h中有如下的描述:
/*
* The socklen definitions are reproduced in netinet/in.h for the inet6_
* functions. Exposing all of sys/socket.h via netinet/in.h breaks existing
* applications and is not required by austin.
*/
在这个文件 /usr/include/arpa/inet.h 中:
#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
#include
#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
#include
#if defined(_XPG4_2) && !defined(__EXTENSIONS__)
#include
#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
In file included from /data03/OBGRP/ob60/ob_rel/include/public/common/base/base_func.h:23,
from /data03/OBGRP/ob60/ob_rel/include/public/common/sdlbuffer/sdl_basic_objs.h:19,
from /data01/JFGRP/wangyl11/work/openbilling60/mediation/codec/sdl/codec_sdl_c.h:16,
from ../src/realtime.h:5,
from ../src/socket_for_tcpserver.cpp:10:
/usr/include/arpa/inet.h:69: error: `socklen_t' has not been declared
/usr/include/arpa/inet.h:72: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:74: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:75: error: variable `in_addr inet_makeaddr' has initializer but incomplete type
/usr/include/arpa/inet.h:75: error: `in_addr_t' was not declared in this scope
/usr/include/arpa/inet.h:75: error: `in_addr_t' was not declared in this scope
/usr/include/arpa/inet.h:76: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:77: error: `in_addr_t' does not name a type
/usr/include/arpa/inet.h:75: error: storage size of `inet_makeaddr' isn't known
上面的说未定义的都可以在/usr/include/netinet/in.h中找到,其中socklen_t在两个文件中定义过:netinet/in.h和sys/socket.h;
在netinet/in.h中有如下的描述:
/*
* The socklen definitions are reproduced here from sys/socket.h so as to
* not introduce that namespace into existing users of netinet/in.h.
*/
在sys/socket.h中有如下的描述:
/*
* The socklen definitions are reproduced in netinet/in.h for the inet6_
* functions. Exposing all of sys/socket.h via netinet/in.h breaks existing
* applications and is not required by austin.
*/
在这个文件 /usr/include/arpa/inet.h 中:
#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
#include
#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
#include
#if defined(_XPG4_2) && !defined(__EXTENSIONS__)
#include
#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
|
你就不能试试吗。
先看看标准怎么说的吧!
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
NAME
sys/socket.h - Internet Protocol family
SYNOPSIS
#include
DESCRIPTION
makes available a type, socklen_t, which is an unsigned opaque integral type of length of at least 32 bits. To forestall portability problems, it is recommended that applications should not use values larger than 232 - 1.
先看看标准怎么说的吧!
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
NAME
sys/socket.h - Internet Protocol family
SYNOPSIS
#include
DESCRIPTION
makes available a type, socklen_t, which is an unsigned opaque integral type of length of at least 32 bits. To forestall portability problems, it is recommended that applications should not use values larger than 232 - 1.
|
Unix下的TCP/IP网络编程包含以下的5个文件,在绝大多数系统都不会有问题,
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
|
#include
#include
#include
我一般就man inetaddr,粘贴上那些头文件够用。
#include
#include
我一般就man inetaddr,粘贴上那些头文件够用。
|
需要指明 defined(__xx__) 类的东西么?
|
#include
|
哎,我也看不出问题所在
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。