Mail Archives: djgpp/1998/09/30/21:55:42
On 30 Sep 98 at 23:58, Yu Jaemin wrote:
> Martin Ambuhl <mambuhl AT earthlink DOT net> wrote:
> > Yu Jaemin wrote:
> >>
> >> FYI, 'gcc -lm test.c'
> >> ~~~
> >>
> >> can link math library to your program.
>
> > FYI, the correct order is 'gcc test.c -lm'
>
> > --
> > Martin Ambuhl (mambuhl AT earthlink DOT net)
> > Note: mambuhl AT tiac DOT net will soon be inactive
>
> well....I'm sorry for that.
> but gcc -lm xxx.c is also working, isn't it?
The linker processes libraries from left to right. It only
links in parts of libraries that have been used by things
appearing to the left of the library on the command line.
I think your command would not have linked any of the library
-- your C file would have been using libc's versions of the
maths functions.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -