Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!uniol!sol.north.de!skuld!core!peic From: peic@core.north.de (Peter Eichler) Newsgroups: comp.sys.amiga.programmer Subject: Re: printf arrays in SAS/C Message-ID: <1925766f.ARN0099@core.north.de> Date: 15 May 91 19:25:51 GMT References: <1991May13.182159.19294@nntp-server.caltech.edu> Reply-To: peic@core.north.de (Peter Eichler) Followup-To: comp.sys.amiga.programmer Organization: Private UUCP-Site Lines: 46 In article <1991May13.182159.19294@nntp-server.caltech.edu>, Robert Andrew Knop writes: #Hi- # #Thank you to everyone who responded to my problem with linking to the amiga #library and reading files. I seem to have that one fixed, although I am #having trouble checking that. 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. # #Thanks, # #-Rob Knop No, in a way, everything is correct. SAC-C uses TWO kinds of printf(). The first is placed in the LC.lib (hope the name is correct) which offers everything but floating point. In this way they avoid linking fp-calls to programs which don't need floating point: It is shorter and faster. The other other one is placed in LCM.lib (usually) and it enables you to use floating-point. Try to compile it with the -Lm option, like lc -d0 -v -Lm foo These "_CVX45" stuff are internal fp-routines... Hope, that helps, Peter