* SUMMARY:C-Compiler/Loader problems libm.a
@ 2000-03-02 15:37 Dipl.-Phys. S. Richter, IKP, Tel. 16-5152
0 siblings, 0 replies; only message in thread
From: Dipl.-Phys. S. Richter, IKP, Tel. 16-5152 @ 2000-03-02 15:37 UTC (permalink / raw)
To: tru64-unix-managers
Hi,
thanks for the acurate and very fast answers!
Joe, joe@meng.ucl.ac.uk
Olle Eriksson, olle@cb.uu.se
Yaacov, y.fenster@ieee.org
Lucio Chiappetti, lucio@ifctr.mi.cnr.it
Chad Price, cprice@molbio.unmc.edu
Peter Stern, Peter.Stern@weizmann.ac.il
Marco Luchini, Marco.Luchini@acco-uk.co.uk
My problem was that the linker couldn't resolve functions out of the libm.a.
The solution to this is - use the -lm
For example
cc bayes.c -lm
instead of only using cc bayes.c.
Regards
Simone
----------------------------- original question ---------------------------
Hi Managers,
I've got a slightly off topic question. One of our users is writin a C-program
and he's using some math fuctions out of math.h. (A small pice of code is
attached).
When compiling the program he gets just those unresolved symbols, he's using ot
of math.h. I checked the libm.a in /usr/ccs/lib - everything seems to be fine
and we made sure that this file is included by specifying LD_LIBRARY_PATH to
/usr/ccs/lib . He has no problems to resolve those symbols defined in libc.a
Anyone can help? Regards
Simone
Dipl.-Phys. Simone Richter simone@ikp.tu-darmstadt.de
Institut f. Kernphysik
Schlossgartenstr. 9 Tel: +49 (0) 6151 / 16-5152, 16-3323
TU Darmstadt
64289 Darmstadt Fax: +49 (0) 6151 / 16-4321
------------------------- Code example --------------------------------------
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
double gasdev(long *idum)
{
static int iset=0;
static double gset;
double fac,rsq,v1,v2;
if (iset == 0) {
do {
v1=2.0*ran2(idum)-1.0;
v2=2.0*ran2(idum)-1.0;
rsq=v1*v1+v2*v2;
} while ((rsq>=1.0) || (rsq == 0.0));
fac=sqrt(-2.0*log(rsq)/rsq);
gset=v1*fac;
iset=1;
return(v2*fac);
} else {
iset=0;
return(gset);
}
}
------------------------- thats the compiler/linker output -------------
>cc bayes.c
ld:
Unresolved:
log
sqrt
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-03-02 15:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-02 15:37 SUMMARY:C-Compiler/Loader problems libm.a Dipl.-Phys. S. Richter, IKP, Tel. 16-5152
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox