2014-11-30 7 views

답변

0

읽기 방법 link libraries with G-WAN합니다. GCC를 사용하는 경우에도 링커에게 사용중인 라이브러리를 알려줘야합니다. G-WAN은 다릅니다. 여기

+0

내가 여러 번 읽었습니다. 나는 hiredis를 일하고 있거나 연결시키는 것처럼 보이지 않습니까? 모든 것을 시도했다. 몇 시간 동안 노력했다. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 정의되지 않은 기호 : ~~~~~~~~~~~~~~~~~~~~~~~~ hell.c을 연결 redisConnectWithTimeout 을 ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ 사용법 #include "gwan.h"// G-WAN을 포함 모두 #pragma 기능 을 수출 도와주세요 사용법 #include "./libraries/hiredis". hiredis를 제대로 연결하기위한 튜토리얼을 제공 할 수 있습니까? 나는 http://ssdb.io/의 CPP가 너무 ... – stashfree

+0

이에 외무성 부상에 대한 dockerize 이미지를 제공하십시오 작업을 얻기 위해 노력하고있어. 부디. 감사! – stashfree

+1

** Docker **는 포장재입니다. 이 타사 제품의 작동 방식을 배우는데 시간을 투자할만한 이유가 없으면 아무도이 작업을하지 않을 것입니다. – Gil

0

내 서버에 작업 내 스크립트를

#include "gwan.h" // G-WAN API 
#pragma link "hiredis" 
#include "hiredis/hiredis.h" 
typedef struct 
{ 
    redisContext *rCont; 
    redisReply *rReply; 
} data_t; 


int main(int argc, char *argv[]) 
{ 
    data_t **d = (data_t**)get_env(argv, US_SERVER_DATA); 
    xbuf_t *reply = get_reply(argv); 
    u64 start = getus(); 
    const char *hostname = "127.0.0.1"; 
    int port = 6379; 
    struct timeval timeout = { 1, 500000 }; // 1.5 seconds 
    if(!d[0]) // first time: persistent pointer is uninitialized 
    { 
    d[0] = (data_t*)calloc(1, sizeof(data_t)); 
    if(!d[0]) 
     return 500; // out of memory 
    d[0]->rCont = redisConnectWithTimeout(hostname, port, timeout); 
    } 

    d[0]->rReply = redisCommand(d[0]->rCont,"PING"); 
    xbuf_xcat(get_reply(argv), "PING %s<br>", d[0]->rReply->str); 
    freeReplyObject(d[0]->rReply); 
    xbuf_xcat(get_reply(argv), "<hr>%llu µs<hr>", getus() - start); 

    return 200; 
} 

당신은 컴파일하고 lib 디렉토리에 복사 hiredis를 얻을 수 있습니다.