Re: log - undefined symbol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> 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

You probably want the -lm at the end (after the source or objects):
  gcc -o executable file.o  -lm



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux