# ld: Undefined symbols  _getopt_long



## James Bond (Aug 10, 2003)

I am trying to compile vmweather under OS X 10.2.6 but get the following message:

[FlatScreen:OSX-Downloads/wmweather-2.4.1/src] roger% make clean
rm -f *.o config.log config.status *~
[FlatScreen:OSX-Downloads/wmweather-2.4.1/src] roger% make
gcc -Wall -I/usr/include -I/sw/include -I/sw/include/gnugetopt -I/usr/X11R6/include -DSYSCONFPATH=\"/usr/local/etc/wmweather.conf\" -I. -I/sw/include -I/usr/include -I/sw/include/gnugetopt -I/usr/X11R6/include  -c -o wmweather.o wmweather.c
gcc -Wall -I/usr/include -I/sw/include -I/sw/include/gnugetopt -I/usr/X11R6/include -DSYSCONFPATH=\"/usr/local/etc/wmweather.conf\" -I. -I/sw/include -I/usr/include -I/sw/include/gnugetopt -I/usr/X11R6/include  -c -o wmgeneral.o wmgeneral.c
gcc -Wall -L/sw/lib  -L/usr/X11R6/lib  wmweather.o wmgeneral.o  -lcurl -lXpm -lXext -lX11  -o wmweather
ld: Undefined symbols:
_getopt_long
make: *** [wmweather] Error 1


How can I find out where this is coming from and eliminate it?     I have tried defining (in the module with main)

long   _getopt_long();

but this does not help!


----------



## Lycander (Aug 10, 2003)

You haven't defined it, you're just re-declaring it. To define it you need to do:

long _getopt_long()
{
   return 0;
}

But I wouldn't recommend doing this because if something does actually call it the result could be anything.

Search in the headers and those of the libs this program links to, for this function. Chances are it's defined in a lib that you do not have.


----------

