This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: log - undefined symbol
- From: Ingo Krabbe <ikrabbe dot ask at web dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 8 Mar 2006 05:58:56 +0100
- Subject: Re: log - undefined symbol
- References: <3291900.post@talk.nabble.com>
Am Mittwoch, 8. März 2006 00:51 schrieb Vijay Gandhi:
> Hello,
>
> I tried compiling a C file using gcc 4.0.0 on SunOS5.8. This file includes
> math.h there is a call on log() in its code. When I compile this C file, I
> get a "undefined symbol referenced error. ld returned 1 exit status."
>
> Any idea how this could be fixed?
>
Try to add -lm to your linker flags:
gcc -lm file.c -o executable
or
gcc file.c -c -o file.o
gcc -lm file.o -o executable
bye ingo