imgsmlr icon indicating copy to clipboard operation
imgsmlr copied to clipboard

error: ‘FALSE’ undeclared (first use in this function)

Open digoal opened this issue 6 years ago • 2 comments

pg 11 make error

root@pg11-test-> USE_PGXS=1 make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O3 -fPIC -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal  -D_GNU_SOURCE   -c -o imgsmlr_idx.o imgsmlr_idx.c
imgsmlr_idx.c:26:1: error: unknown type name ‘typedefenum’
 typedefenum __bool {false = 0,true =1, }bool;
 ^
imgsmlr_idx.c:26:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 typedefenum __bool {false = 0,true =1, }bool;
                    ^
imgsmlr_idx.c:26:20: warning: useless type name in empty declaration [enabled by default]
In file included from imgsmlr_idx.c:18:0:
imgsmlr_idx.c: In function ‘signature_compress’:
imgsmlr_idx.c:69:23: error: ‘FALSE’ undeclared (first use in this function)
        entry->offset, FALSE);
                       ^
/usr/pgsql-11/include/server/access/gist.h:171:37: note: in definition of macro ‘gistentryinit’
    (e).offset = (o); (e).leafkey = (l); } while (0)
                                     ^
imgsmlr_idx.c:69:23: note: each undeclared identifier is reported only once for each function it appears in
        entry->offset, FALSE);
                       ^
/usr/pgsql-11/include/server/access/gist.h:171:37: note: in definition of macro ‘gistentryinit’
    (e).offset = (o); (e).leafkey = (l); } while (0)
                                     ^
imgsmlr_idx.c: In function ‘signature_decompress’:
imgsmlr_idx.c:91:23: error: ‘FALSE’ undeclared (first use in this function)
        entry->offset, FALSE);
                       ^
/usr/pgsql-11/include/server/access/gist.h:171:37: note: in definition of macro ‘gistentryinit’
    (e).offset = (o); (e).leafkey = (l); } while (0)
                                     ^
make: *** [imgsmlr_idx.o] Error 1

add it to .h

#ifndef FALSE
#define FALSE   (0)
#endif


#ifndef TRUE
#define TRUE    (!FALSE)
#endif

digoal avatar Sep 04 '18 07:09 digoal

This method is also usefull if you chose PostgreSQL 13.1.

ghost avatar Apr 02 '21 02:04 ghost

Works for PostgreSQL 14.1

yohanespradono avatar Dec 09 '21 02:12 yohanespradono