thanks a lot! this saved me days of research and bashing my head on hacking at my own way of solving the sqrt of a number (or a double at that).
btw, math.h is part of the standard libraries, right? does this really happen whenever you link (or the compiler links) the library statically to your program? i am aware that you need to explicitly indicate the -l(libname) flag if you're using libraries that already have .o's in your system. but how come that the other libs that come with the linux distro (unistd.h, sys/*.h, net/*.h, etc.) don't need that explicit linking? is this something that just came up with the new gcc-3 line, or is this something already happening in the gcc-2.95.x compilers? enlightenment is most welcome. =) On Fri, 2003-04-04 at 14:55, Rafael 'Dido' Sevilla wrote: > On Fri, Apr 04, 2003 at 01:26:25PM +0800, Dean Michael Berris wrote: > > in the shell: > > > > [EMAIL PROTECTED]:~/src/csrc$ gcc prime.c -o prime > > /tmp/ccAwYhXb.o(.text+0x2c): In function `isprime': > > : undefined reference to `sqrt' > > collect2: ld returned 1 exit status > > > > what am i doing wrong here? any ideas? i'm bothered because i might get > > the same errors when trying to develop applications later that would use > > the gcc-3 compiler family. > > try doing > > gcc -o prime prime.c -lm > > that links in the math library where sqrt lives. -- Dean Michael Berris <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
