cc - "Undefined symbol first referenced in file" - missing lib file?
807578Jan 14 2008 — edited Jan 25 2008This is probably a very simple problem, but I can't seem to use any functions in math.h. gcc builds this code fine. Any thoughts? (cc has been working fine otherwise.)
TIA!
-bash-3.00# uname -a
SunOS triton 5.10 Generic_127112-05 i86pc i386 i86pc
-bash-3.00# cat sample.c
#include <stdio.h>
#include <math.h>
void main()
{
printf("%f\n", sqrt(4.0));
}
-bash-3.00# cc -V# sample.c
cc: Sun C 5.9 SunOS_i386 Patch 124868-02 2007/11/27
### Note: NLSPATH = /opt/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
### command line files and options (expanded):
### -V sample.c
/opt/SUNWspro/prod/bin/acomp -xldscope=global -i sample.c -y-fbe -y/opt/SUNWspro/prod/bin/fbe -y-xarch=generic -y-o -ysample.o -y-verbose -y-xthreadvar=no%dynamic -y-comdat -xdbggen=no%stabs+dwarf2+usedonly -V -xdbggen=incl -y-s -m32 -fparam_ir -Qy -D__SunOS_5_10 -D__SUNPRO_C=0x590 -D__SVR4 -D__sun -D__SunOS -D__unix -D__i386 -D__BUILTIN_VA_ARG_INCR -D__C99FEATURES__ -Xa -D__PRAGMA_REDEFINE_EXTNAME -Dunix -Dsun -Di386 -D__RESTRICT -xc99=%all,no%lib -D__FLT_EVAL_METHOD__=-1 -I/opt/SUNWspro/prod/include/cc "-g/opt/SUNWspro/prod/bin/cc -V# -c " -fsimple=0 -D__SUN_PREFETCH -destination_ir=yabe
acomp: Sun C 5.9 SunOS_i386 Patch 124868-02 2007/11/27
/opt/SUNWspro/prod/bin/fbe -s -o sample.o -warn=%none -Qy /tmp/yabeAAAOaaigl
rm /tmp/yabeAAAOaaigl
### Note: LD_LIBRARY_PATH = <null>
### Note: LD_RUN_PATH = <null>
/usr/ccs/bin/ld /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/values-xa.o -V sample.o -Y "P,/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib" -Qy -lc /opt/SUNWspro/prod/lib/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.488
Undefined first referenced
symbol in file
sqrt sample.o
ld: fatal: Symbol referencing errors. No output written to a.out