Re[2]: Errors compiling dbcopy.ec
Posted in 1998
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
Thanks for the response(s)... The following response hit the nail on the head and provided the simplest solution: "Do you have the ANSI-C compiler on your HP? The standard C compiler that comes with HP-UX does not understand the ANSI features. On top of that, the ANSI-C compiler defaults to non-ANSI mode. Check the man pages and you'll see that the default is the K&R C dialect. If you have the ANSI-C compiler, add the switch '-Ae' or '-Aa' to the command line (e.g. 'esql -Ae dbcopy.ec')." I performed an "> esql -Ae dbcopy.ec" AND... IT WORKED !! (Thanks Mike and Art) ______________________________ Reply Separator _________________________________ Subject: Re: Errors compiling dbcopy.ec Author: kagel@bloomberg.net%smtp at x400po Date: 6/3/98 11:30 AM Mark.Wise@ps.net wrote: > > I downloaded a dbcopy utility from the IIUG repository . My problem is > when I try compiling it with esql I get the following error messages. > I am on HPUX10.2 , 7.23 UC1X8. [SNIPPED REPEATED MESSAGE] > cc: "dbcopy.ec", line 86: error 1705: Function prototypes are an ANSI > feature. > cc: "dbcopy.ec", line 326: error 1000: Unexpected symbol: ")". > cc: error 2017: Cannot recover from earlier errors, terminating. > > Any suggestions? I'm the author of that utility. The source uses ANSI "C" function prototypes and apparently the default "C" compiler that ESQL/C is using on your platform is not ANSI compliant. If you have another ANSI compliant compiler available, set the INFORMIXC environment variable to the name of that compiler's driver program (ie INFORMIXC=gcc for GNU C) and export INFORMIXC. The esql script calls $CC which is set as follows: CC=${INFORMIXC=cc} on most platforms. The default compiler driver is not ANSI C. If you do not have ANSI C you will have to edit the source and modify the function prototypes and declarations to K&R style. ANSI C is so prevalent these days that I have stopped writting code portable to K&R compilers myself. Sorry about that. The error reported about line 326 is a typecast of a NULL pointer using a typedef'd type to cast the NULL to a pointer to struct datetime, or typedef dtime_t, which is not an ANSI feature so I do not know why the compiler is complaining. It looks like a bug in the compiler's parser. You might try putting parenthesis around the entire rvalue: dtime_t *dt = ((dtime_t *)NULL); or initialize the pointer after the declaration block: dtime_t *dt; char string[1025]; dt = (dtime_t *)NULL; Art S. Kagel