From: David E. <de...@us...> - 2006-12-29 23:25:51
|
John R. Culleton wrote: > ... > That didn't work so I built two toys and compiled/linked them thus: > > htcobol -F -c testmain.cbl > htcobol -F -c testcalled.cbl > gcc -o testprog testmain.o testcalled.o > > On the gcc step I got multiple errors, such as: > ..... > testcalled.o(.text+0x92): In function `TESTCALLED': > : undefined reference to `tcob_move' > testcalled.o(.text+0xb7): In function `TESTCALLED': > : undefined reference to `tcob_stop_run' > ... > I think I am missing a library call somewhere. > Which library and on which compile command string? > Or is it something else? You neglected to add the libraries for the link step. Normally TC (htcobol) will add the libraries to the linkage, as shown below. If however you choose to use GCC directly, you have to add the libraries for the link step. $make htcobol -c -P -I../copybooks -I. test03.cob gcc -o test03 test03.o -L/usr/local/lib -lhtcobol -ldb1 -lm -ldl $htcobol -v -test03.cob as -o test03.o test03.s gcc -o test03 test03.o -L/usr/local/lib -lhtcobol -ldb1 -ldl -lm $make -n test15 htcobol -c -P -I../copybooks -I. test15.cob htcobol -c -P -I../copybooks -I. test15a.cob gcc -I/usr/local/include -o test15b.o -c test15b.c gcc -o test15 test15.o test15a.o test15b.o \ -L/usr/local/lib -lhtcobol -ldb -ldl -lm Hint: If you prefer to use a specific format (fixed or free) for your source files, change the default to that format in the TC resource file (htcobolrc). # Specify COBOL program default input format # free format -> PGM_FORMAT_FREE # fixed format -> PGM_FORMAT_FIXED # (compiler default=free format) #PGM_FORMAT_FREE PGM_FORMAT_FIXED If you are working with libraries, same youself some work by using make files. Hope this helps. |