gpt4 book ai didi

redis - 使用 hiredis(redis 客户端库)

转载 作者:可可西里 更新时间:2023-11-01 11:01:36 24 4
gpt4 key购买 nike

我安装了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: 找不到 -lhirediscollect2: ld 返回 1 个退出状态

我不确定如何解决这个问题。请帮忙。

最佳答案

gcc -o example example.c -lhiredis $(pkg-config --cflags --libs glib-2.0)

关于redis - 使用 hiredis(redis 客户端库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18774583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com