By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,170 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,170 IT Pros & Developers. It's quick & easy.

prob linking C with db2

P: 1
im trying a simple C program to create table in db2 database named sample. the 1st 4 steps are fine....precompile,bind,compilation are fine. but
im getting the following error wen i try to link

db2admin@loga ~
$ gcc -o dbmcon1 dbmcon1.o -L$DB2TEMPDIR/lib -ldb2
/usr/bin/ld: cannot find -ldb2
collect2: ld returned 1 exit status

if i try without -ldb2, i get the following error

db2admin@loga ~
$ gcc -o dbmcon1 dbmcon1.o -L$DB2TEMPDIR/lib
dbmcon1.o:dbmcon1.c:(.text+0x92): undefined reference to `_sqlastrt@12'
dbmcon1.o:dbmcon1.c:(.text+0xc1): undefined reference to `_sqlacall@20'
dbmcon1.o:dbmcon1.c:(.text+0xd0): undefined reference to `_sqlastop@4'
dbmcon1.o:dbmcon1.c:(.text+0xf9): undefined reference to `_SqlInfoPrint'
dbmcon1.o:dbmcon1.c:(.text+0x107): undefined reference to `_TransRollback'
dbmcon1.o:dbmcon1.c:(.text+0x183): undefined reference to `_sqlastrt@12'
dbmcon1.o:dbmcon1.c:(.text+0x1b2): undefined reference to `_sqlacall@20'
dbmcon1.o:dbmcon1.c:(.text+0x1c1): undefined reference to `_sqlastop@4'
dbmcon1.o:dbmcon1.c:(.text+0x1ea): undefined reference to `_SqlInfoPrint'
dbmcon1.o:dbmcon1.c:(.text+0x1f8): undefined reference to `_TransRollback'
/usr/bin/../lib/libcygwin.a(libcmain.o):(.text+0xab): undefined reference to `_W
inMain@16'
collect2: ld returned 1 exit status

i tried compilation and linking in one step..even then im getting the same error....


db2admin@loga ~
$ gcc -I$DB2TEMPDIR/include -L$DB2TEMPDIR/lib dbmcon1.c
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x92):
ndefined reference to `_sqlastrt@12'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0xc1):
ndefined reference to `_sqlacall@20'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0xd0):
ndefined reference to `_sqlastop@4'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0xf9):
ndefined reference to `_SqlInfoPrint'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x107):
undefined reference to `_TransRollback'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x183):
undefined reference to `_sqlastrt@12'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x1b2):
undefined reference to `_sqlacall@20'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x1c1):
undefined reference to `_sqlastop@4'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x1ea):
undefined reference to `_SqlInfoPrint'
/cygdrive/c/DOCUME~1/db2admin/LOCALS~1/Temp/ccIOCNYX.o:dbmcon1.c:(.text+0x1f8):
undefined reference to `_TransRollback'
/usr/bin/../lib/libcygwin.a(libcmain.o):(.text+0xab): undefined reference to `_
inMain@16'
collect2: ld returned 1 exit status

db2admin@loga ~
$
Apr 10 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.