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> :
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章