Return to BSD News archive
Newsgroups: comp.os.386bsd.development Path: sserve!manuel.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!crcnis1.unl.edu!wupost!cs.utexas.edu!uunet!email!vlsivie!volker From: volker@vlsivie.tuwien.ac.at (Volker Hamann) Subject: Re: those darn libraries Message-ID: <1993Mar3.193506.16909@email.tuwien.ac.at> Sender: news@email.tuwien.ac.at Nntp-Posting-Host: elba.vlsivie.tuwien.ac.at Reply-To: volker@vlsivie.tuwien.ac.at (Volker Hamann) Organization: Technical University of Vienna References: <1993Mar3.003329.17295@mcshub.dcss.mcmaster.ca> Date: Wed, 3 Mar 1993 19:35:06 GMT Lines: 31 In <1993Mar3.003329.17295@mcshub.dcss.mcmaster.ca> cs3mh3bx@maccs.mcmaster.ca (Dan Marino #13) writes: >#include <math.h> >main() >{ > double x; > x = sqrt(26); >} ># cc -lm name.of.above.file >unresolved sysmbol _sqrt >-------------------------------- >Does anyone see what is wrong with the above. I did a grep sqrt libm.a and >it is there so why can't the linker resolve the sqrt symbol? >Help!!!! Easy. As libraries are searched by ld in the order of already found symbols in the C program, the option "-lm" must be placed BEHIND the object file names: cc name.of.above.file -lm -- | /| ! Volker Hamann ! Email: volker@vlsivie.tuwien.ac.at | / | ! Department for VLSI Design ! Phone: (++43 1) 58801-8142 |-/--| ! University of Technology ! Fax: (++43 1) 569697 |/ | ! Vienna, Austria "IS THERE ANYBODY OUT THERE?"