Skip to content

Resolve warning: "implicit declaration of function ‘getopt’ [-Wimplicit-function-declaration]"

CanWood requested to merge CanWood/poppler:CanWood-master-patch-89708 into master

Building 21.0.3.0 resulted in the following:

/mnt/lustre/admin/software/src/poppler/poppler-21.03.0/glib/tests/pdfdrawbb.c:64:19: warning: implicit declaration of function ‘getopt’ [-Wimplicit-function-declaration]
     while ((opt = getopt(argc, argv, "h")) != -1)
                   ^~~~~~
/mnt/lustre/admin/software/src/poppler/poppler-21.03.0/glib/tests/pdfdrawbb.c:71:30: error: ‘optind’ undeclared (first use in this function)
     if (!usage && argc - 1 < optind) {

Explicitly including getopt.h resolved this.

Merge request reports