Hi:
how r u?!
i'm a Chinese man ,a lover of LINUX,i'm very glad to get ur email ,and very glad to make friends with u .
now ,i have a question need ur help ,that my visit.c can't access sybase DATABASE ,the step and result as follow:
tell me ,what shall i do????
some wrong remains when i compile my C code under LINUX.
my visit.c access sybase still failed ,i have no any idea ,so ,i need ur help !
any way, i appricate ur help !^_^and look forward to ur helping ,answer me as quickly as u can please !
my email:
xhs1314@cmmail.com
my OS : LINUX REDHAT 8.0
gcc version : 3.2.2
DB : sybase
/*the file name:visit.c */
#include<stdlib.h>
#include<string.h>
#include<sybfront.h>
#include<sybdb.h>
#include<syberror.h>
LOGINREC *loginrec;
DBPROCESS *dbproc;
RETCODE return_code;
char organ_no[5],account_no[6];
unsigned amount;
char cmdstr[450];
int
main(int argc,char **argv)
{
strcpy(organ_no,"0301");
strcpy(account_no,"00802");
amount=888.88;
organ_no[4]=account_no[5]='\0';
sprintf(cmdstr,"execss_jz\' %s\',\'%s\',\'%d\'",organ_no,account_no,amount);
conn_init();
system ("clean");
printf ("\n\n\n count success!");
getchar ();
dbexit ();
}
conn_init()
{
if(dbinit()==FAIL)printf("initionalize fail!");
if((loginrec=dblogin())==NULL)printf("register fail!");
if((DBSETLPWD(loginrec,"nhusr"))==FAIL)printf("DATABASE password error ");
if((dbproc=dbopen(loginrec,NULL))==NULL)printf("can't connect to DB");
if((dbuse(dbproc,"nhdb"))==FAIL)printf("open the DB fail!");
}
编译上面的文件结果如下:
file://when i compile the visit.c ,the result as follow:
[root@server test]# gcc -I. -I/opt/sybase-11.9.2/include visit.c /opt/sybase-11.9.2/lib/libsybdb.a -o visit /opt/sybase-11.9.2/lib/libsybdb.a(dbcursut.o)(.text+0xbb): In function `db__crs_search_phrase':
: undefined reference to `__ctype_tolower'
/opt/sybase-11.9.2/lib/libsybdb.a(dbcursut.o)(.text+0x110): In function `db__crs_search_phrase':
: undefined reference to `__ctype_tolower'
/opt/sybase-11.9.2/lib/libsybdb.a(intslist.o)(.text+0x17e): In function `intl__strblist':
: undefined reference to `__ctype_b'
/opt/sybase-11.9.2/lib/libsybdb.a(intnent.o)(.text+0xbf): In function `intl_nextentry':
: undefined reference to `__ctype_b'
/opt/sybase-11.9.2/lib/libsybdb.a(intnent.o)(.text+0x113): In function `intl_nextentry':
: undefined reference to `__ctype_b'
/opt/sybase-11.9.2/lib/libsybdb.a(intnent.o)(.text+0x1b6): In function `intl_nextentry':
: undefined reference to `__ctype_b'
/opt/sybase-11.9.2/lib/libsybdb.a(intnval.o)(.text+0x429): In function `intl_nextvalue':
: undefined reference to `__ctype_b'
/opt/sybase-11.9.2/lib/libsybdb.a(intnval.o)(.text+0x453): more undefined references to `__ctype_b' follow
collect2: ld returned 1 exit status
用Makefile执行的结果也同上面一样
when i excute with Makefile (as follow ),same result appear,
/* Makefile */
visit:visit.c
gcc -I. -I/opt/sybase/include visit.c /opt/sybase-11.9.2/lib/libblk.a /opt/sybase-11.9.2/lib/li
bcomn.a /opt/sybase-11.9.2/lib/libcs.a /opt/sybase-11.9.2/lib/libct.a /opt/sybas
e-11.9.2/lib/libintl.a /opt/sybase-11.9.2/lib/libsybdb.a /opt/sybase-11.9.2/lib/
libsybtcl.a -o visit
[root@server root]#cd /opt/sybase-9.11.2/lib
[root@server lib]# ls
examples.so libcomn.so libct.a libintl.a libssfile.so libsybdb.a libsybtcl.so
libblk.a libcs.a libct.so libintl.so libsstasks6.so libsybdb.so sybsyesp.so
libcomn.a libcs.so libinsck.so libssencode.so libsstools6.so libsybtcl.a xpsmsgs.so