我已经安装了redis服务器,可以从命令行使用它。现在,我想用hiredis编写一个客户端程序。首先,我尝试编译hiredis目录中的example.c:
vishal@expmach:~/redis-2.6.14/deps/hiredis$ ls
adapters async.h COPYING dict.h *example.c* example-libevent.c
hiredis.c Makefile net.h sds.c test.c async.c CHANGELOG.md dict.c example-
ae.c example-libev.c fmacros.h hiredis.h net.c README.md sds.h以下是命令:
vishal@expmach:~/redis-2.6.14/deps/hiredis$ gcc -c -I hiredis example.c
vishal@expmach:~/redis-2.6.14/deps/hiredis$ gcc -o example -I hiredis -L hiredis -lhiredis -lm/usr/bin/ ld :找不到-lhiredis collect2: ld返回%1退出状态
我不知道该如何解决这个问题。请帮帮忙。
发布于 2019-05-30 11:19:26
gcc -o example example.c -lhiredis $(pkg-config --cflags --libs glib-2.0)发布于 2013-09-13 22:35:14
为什么不直接使用提供的Makefile呢?
make
./hiredis-示例
https://stackoverflow.com/questions/18774583
复制相似问题