错误:'IOV_MAX'未声明(首次使用此功能)

时间:2012-01-26 22:28:07

标签: c++ c gcc

我正在尝试安装memcached-1.2.8-repcached-2.2.1

运行make后出现以下错误:

$ make  all-recursive 
make[1]: Entering directory `/usr/local/src/pro/memcached-1.2.8-repcached-2.2.1'     
Making all in doc
make[2]: Entering directory `/usr/local/src/pro/memcached-1.2.8-repcached-2.2.1/doc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/local/src/pro/memcached-1.2.8-repcached-2.2.1/doc'
make[2]: Entering directory `/usr/local/src/pro/memcached-1.2.8-repcached-2.2.1'
gcc -DHAVE_CONFIG_H -I.  -DNDEBUG   -g -O2 -MT memcached-memcached.o -MD -MP -MF 
.d eps/memcached-memcached.Tpo -c -o memcached-memcached.o `test -f 'memcached.c' || echo './'`memcached.c
memcached.c: In function ‘add_iov’:
memcached.c:697: error: ‘IOV_MAX’ undeclared (first use in this function)
memcached.c:697: error: (Each undeclared identifier is reported only once
memcached.c:697: error: for each function it appears in.)
make[2]: *** [memcached-memcached.o] Error 1     
make[2]: Leaving directory `/usr/local/src/pro/memcached-1.2.8-repcached-2.2.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/pro/memcached-1.2.8-repcached-2.2.1'
make: *** [all] Error 2

操作系统:Centos5.7 64位

GCC-4.1.2-51.el5

GCC-C ++ - 4.1.2-51.el5

libgcc中-4.1.2-51.el5

gcc,文件头等中的IOV_MAX有什么问题吗?

3 个答案:

答案 0 :(得分:1)

这表示包含文件或包含路径或环境存在缺陷。

如何定义它是直截了当的:

memcached.c第33行应定义__need_IOV_MAX
memcached.c第42行包含stdio.h
无论如何stdio.h(在我的系统上)第161行包含bits/stdio_lim.h
stdio_lim.h的最后一行(第42-43行)应该定义它:

#if defined __need_IOV_MAX && !defined IOV_MAX
# define IOV_MAX 1024
#endif

我尝试构建memcached,但有些东西搞砸了它取决于libevent。这是Fedora 15上configure的最后几行:

...
checking for a BSD-compatible install... /usr/bin/install -c
checking for libevent directory... configure: error: libevent is required.
You can get it from http://www.monkey.org/~provos/libevent/

      If it's already installed, specify its path using --with-libevent=/dir/

[wally@lenovotower memcached-1.2.8-repcached-2.2.1]$ rpm -q libevent
libevent-2.0.10-2.fc15.i686
[wally@lenovotower memcached-1.2.8-repcached-2.2.1]$ 

event.h中的任何地方都没有/usr/...

答案 1 :(得分:1)

你应该

yum删除libevent2-devel

yum install libevent libevent-devel

答案 2 :(得分:1)

如果您在Ubuntu 12.10(以及可能的其他版本)上编译的情况相同,则需要安装libevent1-dev软件包。