Reputation: 2301
Thanks to someone on this site, I was able to use a sample C++ source file. https://gist.github.com/1893378 When I compile this, I get a bunch of strange compiler errors:
/home/.../workspace/redis-hiredis-3c46b13/pipelineTest.cpp: In function ‘void redisTop(redisContext*)’:
/home/.../workspace/redis-hiredis-3c46b13/pipelineTest.cpp:142:32: error: invalid conversion from ‘void*’ to ‘redisReply*’
/home/../workspace/redis-hiredis-3c46b13/pipelineTest.cpp:162:25: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’
/home/=.../workspace/redis-hiredis-3c46b13/pipelineTest.cpp: In function ‘int main(int, char**)’:
I realize I may be out of synch with hiredis libray but I am using the latest one. Any ideas how to properly build this C++ program?
Also, I am looking for a complete C++ tutorial of pipeline with Redis. Here is a really good example in Java:
http://www.cafebabe.me/2011/05/redis-pipelines-and-transactions.html
Is there no example tutorial like this for C++?
Thanks either way
Upvotes: 1
Views: 3678
Reputation: 3869
Just cast redisCommand to redisReply
reply = (redisReply *)redisCommand(context, "PING");
Upvotes: 2
Reputation: 73206
Actually, it is a C program, not C++. The C++ compiler is usually more pedantic that a C compiler, and it complains. Minor adaptations are needed to compile with a C++ compiler.
I did them, and put the file online again: https://gist.github.com/1893378
It now compiles fine with g++ 3.4 and 4.3
AFAIK, there is no C++ tutorial for Redis. I think the best way to deal with Redis in C++ is to develop your own wrapping classes on top of hiredis. It is not that hard.
Upvotes: 2