zoukankan      html  css  js  c++  java
  • 安装 libevent 出错: event.c error: 'CLOCK_MONOTONIC' undeclared

    安装 libevent 出错: event.c error: 'CLOCK_MONOTONIC' undeclared


    在编译 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> :

    /* 直接在event.c文件最上面include time.h 就可以了. /
    #include <time.h>
    /
    以下是源码, 不用管! */
    #ifdef HAVE_CONFIG_H
    #include "config.h"
    #endif


    [reference]

    CADN ACM_devil 安装memcached (他没说要 include 什么...)

  • 相关阅读:
    java前三章总结
    Java入门第二章
    java编程入门小结
    Java入门第二章
    java预习易错点
    计算机基础
    切换卡
    ajax
    水印4
    shuiyin3
  • 原文地址:https://www.cnblogs.com/TaylorBoy/p/7403251.html
Copyright © 2011-2022 走看看