Compiling on MacOS X 10.3.9 gives this error: Making all in src if gcc -DLOCALEDIR=\"/Volumes/UserData/local-macos/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I../gnulib/lib -I../gnulib/lib -Wall -I/Volumes/UserData/local-macos/include -g -O2 -MT hello.o -MD -MP -MF ".deps/hello.Tpo" -c -o hello.o hello.c; \ then mv -f ".deps/hello.Tpo" ".deps/hello.Po"; else rm -f ".deps/hello.Tpo"; exit 1; fi hello.c: In function `main': hello.c:142: warning: too many arguments for format gcc -g -O2 -o hello hello.o -L/Volumes/UserData/local-macos/lib -lintl -liconv -lc -Wl,-framework -Wl,CoreFoundation ../gnulib/lib/libgnu.a ld: warning multiple definitions of symbol _locale_charset /Volumes/UserData/local-macos/lib/libintl.dylib(localcharset.o) definition of _locale_charset /usr/lib/libiconv.dylib(localcharset.o) definition of _locale_charset ld: Undefined symbols: _program_name make[2]: *** [hello] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
The reason is that you use the module 'error' without defining 'program_name'. Until I've reworked the 'program_name' handling (still on my TODO list), the recommended fix is this. 2006-08-21 Bruno Haible <[EMAIL PROTECTED]> * src/hello.c (program_name): Renamed from progname. Make non-static. (main): Update. *** src/hello.c.bak Mon Aug 21 01:43:04 2006 --- src/hello.c Tue Aug 22 01:17:09 2006 *************** *** 20,25 **** --- 20,28 ---- #include <config.h> #include "system.h" + /* String containing name the program is called with. */ + const char *program_name; + struct option longopts[] = { { "greeting", required_argument, NULL, 'g' }, *************** *** 30,37 **** { NULL, 0, NULL, 0 } }; - static char *progname; - int main (argc, argv) int argc; --- 33,38 ---- *************** *** 41,47 **** int h = 0, v = 0, t = 0, n = 0, lose = 0; char *greeting = NULL; ! progname = argv[0]; #ifdef HAVE_SETLOCALE /* Set locale via LC_ALL. */ --- 42,48 ---- int h = 0, v = 0, t = 0, n = 0, lose = 0; char *greeting = NULL; ! program_name = argv[0]; #ifdef HAVE_SETLOCALE /* Set locale via LC_ALL. */ *************** *** 84,90 **** if (optind < argc) fputs (_("Too many arguments\n"), stderr); fprintf (stderr, _("Try `%s --help' for more information.\n"), ! progname); exit (1); } --- 85,91 ---- if (optind < argc) fputs (_("Too many arguments\n"), stderr); fprintf (stderr, _("Try `%s --help' for more information.\n"), ! program_name); exit (1); } *************** *** 103,109 **** /* TRANSLATORS: --help output 2 no-wrap */ printf (_("\ ! Usage: %s [OPTION]...\n"), progname); printf ("\n"); /* TRANSLATORS: --help output 3 : options 1/2 --- 104,110 ---- /* TRANSLATORS: --help output 2 no-wrap */ printf (_("\ ! Usage: %s [OPTION]...\n"), program_name); printf ("\n"); /* TRANSLATORS: --help output 3 : options 1/2