Message-Id: <199810010155.VAA28401@delorie.com> Comments: Authenticated sender is From: "George Foot" To: Yu Jaemin Date: Thu, 1 Oct 1998 02:53:16 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Need for Math library Reply-to: mert0407 AT sable DOT ox DOT ac DOT uk CC: djgpp AT delorie DOT com X-mailer: Pegasus Mail for Win32 (v2.42a) On 30 Sep 98 at 23:58, Yu Jaemin wrote: > Martin Ambuhl 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