This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: log - undefined symbol


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]