libevent 编译出错记

系统运维,centos 2017-11-06

libevent-2.0.12-stable 编译出错:

i686-pc-linux-gnu-gcc -O2 -march=i686 -pipe -g -Wall -I../include -I../include
-DVERSION=1.05 -g -L.  -o btlist btlist.c -lbt -lresolv -luuid -lssl -lcurl 
`curl-config --libs` -lm
In file included from btlist.c:16:
/usr/include/openssl/sha.h:109: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:111: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:116: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:118: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:138: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:140: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:142: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:144: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:185: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:187: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:189: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:191: error: expected declaration specifiers or '...'
before 'size_t'

几经周折终于找到了答案:
在config.h 文件中添加一行 头文件的引用中:
#include <sys/types.h>
然后make clean之后再重新

./configure 和 make 就搞定了


本文由 伯仁 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论