Menu

#13 nmonmerge2 doesn´t compile on debian 9.11

Unstable (example)
closed
nobody
None
5
2022-11-14
2020-02-27
Joerg Esser
No

Under Debian 9.11 I get this error
gcc -o nmonmerge -O3 nmonmerge2.c
nmonmerge2.c: In function ‘main’:
nmonmerge2.c:60:21: warning: implicit declaration of function ‘getopt’ [-Wimplicit-function-declaration]
while ( -1 != (i = getopt(argc, argv, "?hva" ))) {
^~~~~~
nmonmerge2.c:73:5: error: ‘optind’ undeclared (first use in this function)
if(optind +2 != argc) {
^~~~~~
nmonmerge2.c:73:5: note: each undeclared identifier is reported only once for each function it appears in
nmonmerge2.c:90:7: warning: implicit declaration of function ‘strncmp’ [-Wimplicit-function-declaration]
if(!strncmp(string, "ZZZZ,T",6)) {
^~~~~~~
nmonmerge2.c:127:7: warning: implicit declaration of function ‘isdigit’ [-Wimplicit-function-declaration]
isdigit(string[j+2]) ) {
^~~~~~~
nmonmerge2.c:166:2: warning: implicit declaration of function ‘unlink’ [-Wimplicit-function-declaration]
unlink(TEMPFILE);
^~~~~~

I added #include <unistd.h> to the file to resolve the error.
Patch in attachment. </unistd.h>

This is just a hack. Dont know the correct way.

Thx for the fish ;)

Joerg

1 Attachments

Discussion

  • Nigel Griffiths

    Nigel Griffiths - 2022-11-14
    • status: open --> closed
     
  • Nigel Griffiths

    Nigel Griffiths - 2022-11-14

    Also added

     #include <ctype.h>
    #include <string.h>
    

    Released as nmonmerge3.c

     

Log in to post a comment.