Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ncar!gatech!usenet.ins.cwru.edu!eagle!data.nas.nasa.gov!xenon.arc.nasa.gov!dueker From: dueker@xenon.arc.nasa.gov (The Code Slinger) Newsgroups: comp.sys.amiga.programmer Subject: Re: printf arrays in SAS/C Summary: Linking with math libraries Keywords: SAS/C lattice math libraries Message-ID: <1991May13.202653.28201@nas.nasa.gov> Date: 13 May 91 17:21:34 GMT References: <1991May13.182159.19294@nntp-server.caltech.edu> Sender: dueker@xenon.arc.nasa.gov Reply-To: dueker@xenon.arc.nasa.gov Followup-To: comp.sys.amiga.programmer Organization: Computer Sciences Corp Lines: 37 News-Software: VAX/VMS VNEWS 1.3-4 In article <1991May13.182159.19294@nntp-server.caltech.edu>, rknop@nntp-server.caltech.edu (Robert Andrew Knop) writes... >Now, I seem to have a different problem, >and that is referencing arrays in printf. Consider the following test >program: > >#include > >main() >{ int i; > float junk[5]; > > for (i=0;i<5;i++) junk[i]=(float)i+0.5; > for (i=0;i<5;i++) printf("junk[i]=%f\n",junk[i]); >} > >Compiled under UNIX, this program works exactly as I would expect it to. >When I try to compile it on my Amiga with SAS/C 5.10, I get four very weird >linker errors. The linker tells me that I am trying to references undefined >symbols. These symbols are something like "_CVX45". Am I forgetting >to include some header file or some such? What is going on here? This has >me quite befuddled. Under SAS/C, when you mess with floats, ya gotta link with math libraries. (The _CVX45 is a giveaway. I've gotten that, too.) The simplest way would be: lc -Lm test.c This tells the linker to link with a math library. There are other math libraries available, too, with different sizes/formats. Chris ------------------------------------------------------------------------ "Ah, Benson, you are so mercifully free of the ravages of intellegence!" "Oh, thank you, Master!" - from the movie, TIME BANDITS ------------------------------------------------------------------------ dueker@xenon.arc.nasa.gov | Chris Dueker (The Code Slinger) duke@well.sf.ca.us | Mtn. View, CA (Sillycon Valley!)