libevent CentOS7 编译

安装 libevent 出错: event.c error: 'CLOCK_MONOTONIC' undeclared
checking build system type... configure: error: cannot guess build type; you must specify one
--build=arm-linux
在编译 libevent-1.2 源码时, make 出错:
event.c:157:20: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
  if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
                    ^
出错原因是: 在 event.c 文件中 CLOCK_MONOTONIC 没有定义.
解决办法 : 在网上搜了下, 是缺少头文件了, CLOCK_MONOTONIC 定义在 time.h 头文件中. 所以可以直接修改源码:
在 event.c 中引用头文件: #include <time.h> :

猜你喜欢

转载自blog.51cto.com/fengyuzaitu/2467338