Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#10 Make fails on tdbtool.c

open
nobody
None
5
2006-12-09
2006-12-09
Anonymous
No

Make fails on tdbtool.c.

Error details below:
-----------------------------------
tdbtool.c: In function `help':
tdbtool.c:172: error: missing terminating " character
tdbtool.c:173: error: `tdbtool' undeclared (first use in this function)
tdbtool.c:173: error: (Each undeclared identifier is reported only once
tdbtool.c:173: error: for each function it appears in.)
tdbtool.c:173: error: syntax error before ':' token
tdbtool.c:187: error: stray '\' in program
tdbtool.c:187: error: stray '\' in program
tdbtool.c:187:34: warning: multi-character character constant
tdbtool.c:188: error: missing terminating " character
make: *** [tdbtool.o] Error 1
-----------------------------------
Build environment:
kernel 2.6.18.3
gcc 3.4.6
Gnu make 3.81
util-linux 2.12r
Linux C Library 2.3.6
Dynamic linker (ldd) 2.3.6
Linux C++ Library 6.0.3

Discussion

  • This happens because multiline strings used to be allowed in older GCC versions, but not in newer ones. To fix it, just rewrite the help function as follows:

    static void help(void)
    {
    printf("tdbtool:\n");
    printf (" create dbname : create a database\n");
    printf (" open dbname : open an existing database\n");
    printf (" erase : erase the database\n");
    printf (" dump dumpname : dump the database as strings\n");
    printf (" insert key data : insert a record\n");
    printf (" store key data : store a record (replace)\n");
    printf (" show key : show a record by key\n");
    printf (" delete key : delete a record by key\n");
    printf (" list : print the database hash table and freelist\n");
    printf (" free : print the database freelist\n");
    printf (" 1 | first : print the first record\n");
    printf (" n | next : print the next record\n");
    printf (" q | quit : terminate\n");
    printf (" \\n : repeat 'next' command\n");
    }