1、 https://github.com/redis/hiredis 在这里下载到源包
你可以在命令行输入 git clone https://github.com/redis/hiredis.git 来获取
2、 cd hiredis
make
此时发现系统目录下多了libhiredis.so
3、 自己写一个测试程序或者从examples目录中把example.c移到当前目录
然后使用gcc编译
gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb test.c
gcc -o test test.o libhiredis.so
./test
如果你看到预期结果,那么恭喜, 如果出现如下错误:
error while loading shared libraries: libhiredis.so.0