jlibtool icon indicating copy to clipboard operation
jlibtool copied to clipboard

Error during compilation

Open absolutelynothinghere opened this issue 1 year ago • 1 comments

Compiling jlibtool with Clang (c99) yields the following error and 2 warnings:

jlibtool.c:1617:11: warning: call to undeclared function 'strdup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                tmp = strdup(arg);
                                      ^
jlibtool.c:1617:9: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
                                tmp = strdup(arg);
                                    ^ ~~~~~~~~~~~
jlibtool.c:2227:2: warning: call to undeclared function 'setenv'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        setenv(LD_LIBRARY_PATH_LOCAL, l, 1);
        ^

Adding -Wno-int-conversion -Wno-implicit-function-declaration to the compiler command silences the error and warnings.

absolutelynothinghere avatar Nov 03 '23 12:11 absolutelynothinghere

The better solution is to include the correct header files which have the function prototypes. I'll take a look.

alandekok avatar Nov 12 '23 14:11 alandekok