Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
星号:对“SQLAllocHandle';_C_Asterisk - Fatal编程技术网

星号:对“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是什么意思?