Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!wuarchive!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.tech Subject: Re: Lattice C -- %f format Message-ID: <22329.25e2b2f2@kuhub.cc.ukans.edu> Date: 21 Feb 90 21:25:37 GMT References: <2427@se-sd.NCR.COM> Distribution: na Organization: University of Kansas Academic Computing Services Lines: 55 > I get an "undefined symbol" message at link time when I compile > and link the following test program on Lattice C 5.04 -- > > #include > > main() > { > float fl = 1.0; > printf("%f\n", fl); > } > > I simply compiled it and linked it by typing "lc -L dummy" ( > the program was dummy.c). Yes, you need to say "lc -Lm dummy". The m tells lc to tell BLink to use the lcm.lib (default math library). You can tell lc "-LXXX" where XXX is the name of any link library (minus the lc). So to use the FFP library instead (lcmffp) as an example say "lc -Lmffp dummy". By the way, the Lattice 5.04 libraries have some bugs in their handling of the %f stuff, (CodeProbe does too). These are fixed with the 5.04a pathes which are available on BIX or the Lattice BBS. > The problem is definetly with the %f format, it works fine if the > float is replaced by an int and %d is used. Yes, printf() does a function call to convert the %f, and that function is in the math libraries. > I am an experienced C programmer but completely new to programming > on the Amiga. I suspect that the linker is not pulling in some > floating point library. The Blink (or lc driving Blink) never automatically pulls in the math libraries, even if you give a floating point option to the compiler phase on the lc command line. > Please email any help to ewing@se-sd.sandiego.ncr.com. My apologies > if this is completely bone-headed or has been discussed ad infinitum > (I couldn't find any reference in my perusal of newuser). The documentation is fairly fuzzy on the details of which .lib or .o file is needed and does what, etc. > Dave Ewing > ewing@se-sd.sandiego.ncr.com -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: markgood \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: mark@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~