I'm in the process of porting INFORMIX ESQL/C code to Postgres.
I've had great success until I've come upon Informix's datetime.h functions.
The code compiles, but when it comes time to link, I get the following error:
gcc -L/usr/local/postgresql-8.0.3/lib -o temp_fcstPg temp_fcst.o timechar.o stresslib.o -lm -lpq -lecpg
temp_fcst.o: In function `main':
temp_fcst.o(.text+0x1fc): undefined reference to `dttoasc'
collect2: ld returned 1 exit status
make: *** [temp_fcstPg] Error 1
dttoasc() is an INFORMIX ESQL/C datetime function.
I've used the -C INFORMIX option with ecpg. The output from the ecpg -C INFORMIX command seems to put the
appropriate header files into the program. Here is an example below:
#line 1 "/usr/local/postgresql-8.0.3/include/informix/esql/datetime.h"
#ifndef _ECPG_DATETIME_H
#define _ECPG_DATETIME_H
#include <ecpg_informix.h>
typedef timestamp dtime_t;
typedef interval intrvl_t;
#endif /* ndef _ECPG_DATETIME_H */
Looking at the contents of the <ecpg_informix.h> file, it seems to declare the dttoasc() function.
My question ???
Why is the program not linking? Is there a library I'm not including? Here is a copy of my Makefile:
PROGRAM = temp_fcstPg
CC1 = ecpg -C INFORMIX
CC2 = gcc -I/usr/local/postgresql-8.0.3/include -c
CC = gcc -L/usr/local/postgresql-8.0.3/lib -o
SRC = temp_fcst.c timechar.c stresslib.c
OBJ = temp_fcst.o timechar.o stresslib.o
LIB = -lm -lpq -lecpg
all::temp_fcstPg
temp_fcst.o: temp_fcst.pgc
$(CC1) temp_fcst.pgc
$(CC2) temp_fcst.c
stresslib.o: stresslib.c
$(CC2) stresslib.c
timechar.o: timechar.c
$(CC2) timechar.c
$(PROGRAM): $(OBJ)
$(CC) $(PROGRAM) $(OBJ) $(LIB)
If anyone can point me in the right direction, I would very much appreciate it!
Thanks!