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.

-- 
Rafael R. Sevilla <dido at imperium dot ph>     +63(2)8123151
Software Developer, Imperium Technology Inc.    +63(917)4458925
 "Patriotism...is nothing else but a means for obtaining for the rulers
  their ambitions and covetous desires, and for the ruled the abdication
  of human dignity, reason, and conscience, and a slavish enthralment
  to those in power."
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph

To subscribe to the Linux Newbies' List: send "subscribe" in the body to [EMAIL 
PROTECTED]

Reply via email to