[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

sqrt / math.h



heya, - og velkommen til mig.

et lille forsøg med sqrt kald, men jeg får en fejl når jeg kompiler -

uhm, jeg har prøvet at ændre path til math.h,

fra "#include <math.h>" til "#include </usr/include/math.h>" - men dette hjælper mig ikke.

godt nok er /usr/include, ikke i gcc's search-dirs, men math.h ligger i /usr/include - kan jeg rett
e default search path for gcc ?

[---]

sslug@sslug c]$ gcc -o sqrt_example sqrt_example.c
/tmp/ccv5zAYV.o: In function `main':
/tmp/ccv5zAYV.o(.text+0x1e): undefined reference to `sqrt'
collect2: ld returned 1 exit status

[---]

sslug@sslug c]$ gcc --print-search-dirs
install: /usr/lib/gcc-lib/i386-redhat-linux/2.96/
programs: =/usr/lib/gcc-lib/i386-redhat-linux/2.96/:/usr/lib/gcc-lib/i386-redhat-linux/2.96/:/usr/l
ib/gcc-lib/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/2.96/:/usr/lib/gcc/i386-redhat-linux/:
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../../i386-redhat-linux/bin/i386-redhat-linux/2.96/:/
usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../../i386-redhat-linux/bin/
libraries: =/usr/lib/gcc-lib/i386-redhat-linux/2.96/:/usr/lib/gcc/i386-redhat-linux/2.96/:/usr/lib/
gcc-lib/i386-redhat-linux/2.96/../../../../i386-redhat-linux/lib/i386-redhat-linux/2.96/:/usr/lib/g
cc-lib/i386-redhat-linux/2.96/../../../../i386-redhat-linux/lib/:/usr/lib/gcc-lib/i386-redhat-linux
/2.96/../../../i386-redhat-linux/2.96/:/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../:/lib/i386-
redhat-linux/2.96/:/lib/:/usr/lib/i386-redhat-linux/2.96/:/usr/lib/
sslug@sslug c]$


[---]
/* sqrt_example */

#include <stdio.h>
#include <math.h>

int main ()
{

  double param, result;

  param = 1024.0;
  result = sqrt (param);
  printf ("sqrt(%lf) = %lf\n", param, result );


  return 0;
}

/* eof */



--
*** Rasmus > Zio < Glud ***
...........................
www.txb.dk/zio | sslug@sslug


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *