星号:对“SQLAllocHandle';
我在星号:对“SQLAllocHandle';,c,asterisk,C,Asterisk,我在asterisk/main目录中添加了一个test.c来测试ODBC。不幸的是,当我运行make时,它显示如下所示 test.o: In function `test_function': /usr/src/asterisk-certified-13.8-cert3/main/libtest.c:10: undefined reference to `SQLAllocHandle' test.c如下: #include "asterisk/res_odbc.h" ASTERIS
asterisk/main
目录中添加了一个test.c来测试ODBC。不幸的是,当我运行make
时,它显示如下所示
test.o: In function `test_function':
/usr/src/asterisk-certified-13.8-cert3/main/libtest.c:10:
undefined reference to `SQLAllocHandle'
test.c
如下:
#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;
}
我怎样才能解决这个问题?谢谢 您应该更改Makefile,以便将libs包含到模块中 但在使用星号时,这是错误的方法
正确的方法是用户实时或func_odbc,并使其关心连接。注意:
res_odbc
包括
,
和
这是链接器错误,因此代码段和.h文件根本不相关。您忘记链接odbc库。如何链接odbc库?我想只需要包含头文件。REALTIME和func_odbc是什么意思?