- 论坛徽章:
- 0
|
我做了一个openclient的程序,内容如下:
#include <stdio.h>;
#include <ctpublic.h>;
main() {
CS_CONTEXT *cntx_ptr;
CS_CONNECTION *conn_ptr;
CS_RETCODE ret;
ret=cs_ctx_alloc(CS_VERSION_100,&cntx_ptr);
ret=ct_init(cntx_ptr,CS_VERSION_100);
ret=ct_con_alloc(cntx_ptr,&conn_ptr);
ret=ct_con_props(conn_ptr,CS_SET,CS_USERNAME,"sa",CS_NULLTERM,NULL);
ret=ct_con_props(conn_ptr,CS_SET,CS_PASSWORD,"test",CS_NULLTERM,NULL);
ret=ct_connect(conn_ptr,NULL,0);
sleep(30);
ret=ct_exit(cntx_ptr,CS_FORCE_EXIT);
ret=cs_ctx_drop(cntx_ptr);
exit(CS_SUCCEED);
}
但是编译时总时出错!!(我安装了openclient for linux)
-bash-2.05b$ gcc -g cts.c -I$SYBASE/include -L$SYBASE/lib >; a.txt
cts.c:28:2: warning: no newline at end of file
/tmp/ccS6RzKF.o(.text+0x1a): In function `main':
/opt/sybase-11.9.2/sample/cts.c:9: undefined reference to `cs_ctx_alloc'
/tmp/ccS6RzKF.o(.text+0x2d):/opt/sybase-11.9.2/sample/cts.c:11: undefined reference to `ct_init'
/tmp/ccS6RzKF.o(.text+0x42):/opt/sybase-11.9.2/sample/cts.c:13: undefined reference to `ct_con_alloc'
/tmp/ccS6RzKF.o(.text+0x63):/opt/sybase-11.9.2/sample/cts.c:15: undefined reference to `ct_con_props'
/tmp/ccS6RzKF.o(.text+0x84):/opt/sybase-11.9.2/sample/cts.c:17: undefined reference to `ct_con_props'
/tmp/ccS6RzKF.o(.text+0x99):/opt/sybase-11.9.2/sample/cts.c:19: undefined reference to `ct_connect'
/tmp/ccS6RzKF.o(.text+0xbc):/opt/sybase-11.9.2/sample/cts.c:23: undefined reference to `ct_exit'
/tmp/ccS6RzKF.o(.text+0xcd):/opt/sybase-11.9.2/sample/cts.c:25: undefined reference to `cs_ctx_drop'
collect2: ld returned 1 exit status |
|