I'm posting this to several of the IIUG lists and CDI since it's generally
useful, hope that's OK with you.
Arrgghh!! This is due to a change I had to make because some UNIXes (notably
AIX) do not have a getopt.h but include the definitions for getopt() and optarg
in stdlib.h. Because of this earlier releases of dostats would not compile on
AIX. Linux does have getopt.h and it IS included from stdio.h (and unistd.h for
that matter) which the new dostats.ec includes, unfortunately, which I did not
notice before, getopt.h is only included if you #define __USE_XOPEN or #define
__USE_XOPEN2K. So either
- add a #define for one of these before the first #include statement
- add -D__USE_XOPEN to the esql commandline
- BEST OPTION (since I do not know what other side-effects the defines will
have): uncomment the #include "getopt.h" that is commented out at the end of
the #include list (just before the first EXEC SQL INCLUDE line) probably around
line 218 or so.
Note for the lists: I will replace the #include with a specific ifdef for Linux
in the next release. If anyone else has a problem compiling on some platform
please let me know and I'll add to the ifdef'd platforms that get the #include.
Art S. Kagel
At: 2/12 3:22
> Dear Mr. Kagel,
> I downloaded the latest version of utils2_ak (dated 2003/02/03)
> from the IIUG-Website and tried to compile dostats.ec (1.85) on a
> RedHat 8.0 system having CSDK 2.80UC1 installed. When I run
> "make dostats" the following error appears:
> dostats.ec: In function `main':dostats.ec:402: `optarg' undeclared (first use
> this function)dostats.ec:402: (Each undeclared identifier is reported only
> oncedostats.ec:402: for each function it appears in.)dostats.ec:941: `optind'
> undeclared (first use in this function)make: *** [dostats] Error 1
> Version 1.74 of dostats.ec from 2002/11/05 compiles fine.
> Could you please check this.
> Kind regards
> Roland Wintgen (Systemadministrator)
> EVG Elektro-Vertriebs-Gesellschaft Martens GmbH & Co KG
> Trompeterallee 244-246, 41189 M?nchengladbach
> Tel. 0 21 66 / 55 08 23, Fax 0 21 66 / 55 08 90