2017-02-08 2 views
0

ODBC를 테스트하기 위해 asterisk/main 디렉토리에 test.c를 추가했습니다. 불행히도 make을 실행하면 아래와 같이 표시됩니다. 별표 : 'SQLAllocHandle'에 대한 정의되지 않은 참조

#include "asterisk/res_odbc.h" 

ASTERISK_FILE_VERSION(__FILE__, "$Revision$") 


int test_function(void){ 
    int res; 
    SQLHANDLE output_handle; 
    res = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &output_handle); 

    if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 
     ast_log(LOG_DEBUG, "AllocHandle Success!\n"); 
     } else { 
      ast_log(LOG_WARNING, "Error AllocHandle"); 
     } 

    return 0; 
} 

가 어떻게이 문제를 해결할 수 있습니다 :이 같은

test.o: In function `test_function': 
/usr/src/asterisk-certified-13.8-cert3/main/libtest.c:10: 
undefined  reference to `SQLAllocHandle' 

test.c? 감사!

+0

참고 :'res_odbc'은''''등을 포함'' –

+0

그것은 링커 오류이므로 코드와 .H 파일이 전혀 관련이 없습니다. odbc 라이브러리를 링크하는 것을 잊었습니다. –

+0

odbc 라이브러리를 연결하는 방법? 헤더 파일을 포함시켜야한다고 생각했습니다. –

답변

0

모듈에 include libs 용 Makefile을 변경해야합니다.

그러나 별표로 작업 할 때 이는 잘못된 방법입니다.

올바른 방법은 사용자 REALTIME 또는 func_odbc이며 연결에주의하십시오.

+0

REALTIME 및 func_odbc의 의미는 무엇입니까? –

+0

https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration – arheops

+0

https://www.voip-info.org/wiki/view/Asterisk+func+func_odbc – arheops