[cfarm-users] getopt on AIX

Jeffrey Walton noloader at gmail.com
Sun Jul 5 20:48:08 CEST 2020


Hi Everyone,

I'm testing on gcc119, which is the AIX ppc64be machine. One of the
source files fails to compile (see below).

According to the getopt(3) man page, the function is available. The
man page says the only include needed is <unistd.h>.

I don't use getopt for my programs so I don't have much experience with it.

Any ideas how to use getopt(3) on AIX?

Thanks in advance.

=========================

Error when including <unistd.h>

b2sum-src/b2sum.c:266:26: error: array type has incomplete element
type 'struct option'
     static struct option long_options[] = {
                          ^~~~~~~~~~~~
b2sum-src/b2sum.c:267:18: error: 'no_argument' undeclared (first use
in this function)
       { "help",  no_argument, 0,  0  },
                  ^~~~~~~~~~~

Error when including <getopt.h>:

b2sum-src/b2sum.c:24:10: fatal error: getopt.h: No such file or directory
 #include <getopt.h>
          ^~~~~~~~~~
compilation terminated.


More information about the cfarm-users mailing list