我想在c中编译redis客户端。我已经下载并安装了libevent库和hiredis文件。我使用了这个命令:
gcc -I/home/tasos/Dropbox/lists/hiredis example-libevent.c -levent
但是我得到这些错误:
/tmp/ccxoerYJ.o: In function `redisLibeventReadEvent':
example-libevent.c:(.text+0x28): undefined reference to `redisAsyncHandleRead'
/tmp/ccxoerYJ.o: In function `redisLibeventWriteEvent':
example-libevent.c:(.text+0x56): undefined reference to `redisAsyncHandleWrite'
/tmp/ccxoerYJ.o: In function `getCallback':
example-libevent.c:(.text+0x2d2): undefined reference to `redisAsyncDisconnect'
/tmp/ccxoerYJ.o: In function `main':
example-libevent.c:(.text+0x393): undefined reference to `redisAsyncConnect'
example-libevent.c:(.text+0x3f3): undefined reference to `redisAsyncSetConnectCallback'
example-libevent.c:(.text+0x404): undefined reference to `redisAsyncSetDisconnectCallback'
example-libevent.c:(.text+0x45d): undefined reference to `redisAsyncCommand'
example-libevent.c:(.text+0x47d): undefined reference to `redisAsyncCommand'
collect2: ld returned 1 exit status
为什么不工作?
在命令中使用-levent
和-lhiredis
编译选项