from iainw on forum.peoplecards.ca, with one edit to put in code blocksHello,
I'm having problem with a program compiling an OpenCOBOL 1.1 program which uses DB2 Express-C in a Windows 7 environment. Following the advice on the forum I have updated libcob.h, adding:
#ifdef DB2SQL
#include <sqlaprep.h>
#endif
Have the following system variables:
COB_LIBRARY_PATH = C:\OC\pgms
COBCPY = C:\OC\pgms
INCLUDE = C:\PROGRA~2\IBM\SQLLIB\INCLUDE;C:\PROGRA~2\IBM\SQLLIB\LIB
LIB = ;C:\PROGRA~2\IBM\SQLLIB\LIB
LINK = C:\Cobol\lib\db2api.lib
PATH is set up to included all required OC and DB2 programs etc.
Using the DB2 Express-C line command processor (DOS window), connected to the sample database and precomiled the program:
(1) connect to sample
(2) prep C:\OC\pgms\db2test2.sqb bindfile using C:\OC\pgms\db2test2.bnd target ANSI_COBOL
In Cgywin tried to compile the program, commans used = cobc -v -x -I C:\PROGRA~2\IBM\SQLLIB\lib -fixed -fstatic -D DB2SQL db2test2.cbl
Get the following:
preprocessing db2test2.cbl into /tmp/cob3872_0.cob
translating /tmp/cob3872_0.cob into /tmp/cob3872_0.c
gcc-4 -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sig
n -IC:PROGRA~2IBMSQLLIBlib -DDB2SQL -o /tmp/cob3872_0.o /tmp/cob3872_0.c
gcc-4 -pipe -Wl,--export-all-symbols -Wl,--enable-auto-import -o db2test2 /tmp/
cob3872_0.o -L/usr/local/lib -lcob -lm -lgmp -lintl -lncurses -ldb
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xaaf): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xb84): undefined reference to `_sqlgaloc'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xcbf): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xdbb): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xe1b): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x11fe): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x12fa): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x135a): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x147f): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1554): undefined reference to `_sqlgaloc'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x169b): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x17e2): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1929): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1a70): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1bb7): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1cfe): more undefined references to `_sqlg
stlv' follow
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1f41): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1fa1): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x22fb): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x23f7): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x2457): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x25cf): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x26cb): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x272b): undefined reference to `_sqlgstop'
collect2: ld returned 1 exit status
Can anyone suggest what I need to do to get a clean compile please?
Regards,
iain