markv@kuhub.cc.ukans.edu (05/13/91)
> <simple C program with FP deleted> > 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. You are forgetting to tell LC (or Blink) to use a Math library. Try: lc -Lm foo.c which says use the standard Lattice IEEE FP library (lcm.lib), as well as lc.lib, or: Blink c.o foo.o lib lib:lcm.lib lib:lc.lib to foo Of course other math libs can be used depending on your needs. Just remember to match the FP format (-f option, IEEE, FFP, etc) to the library or you'll get strange results. > Thanks, > > -Rob Knop > rknop@tybalt.caltech.edu -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dueker@xenon.arc.nasa.gov (The Code Slinger) (05/14/91)
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 <stdio.h> > >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 <default?> 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!)
rknop@nntp-server.caltech.edu (Robert Andrew Knop) (05/14/91)
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 <stdio.h>
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
rknop@tybalt.caltech.edu
rknop@nntp-server.caltech.edu (Robert Andrew Knop) (05/14/91)
Again, thank you to everyone who responeded re: my problem using floating point variables. The consensus was (and this worked to) that I was having trouble because I was using floating point variables and hadn't linked to the math library with -Lm. -Rob Knop rknop@tybalt.caltech.edu
peic@core.north.de (Peter Eichler) (05/16/91)
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 <stdio.h>
#
#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