This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

need help


After compiling this simple program

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


int main(void)
{
  printf("%d", sqrt(10));

  return 0;
}

with this makefile
new : new.o
	cc -o new new.o

new.o : new.c
	cc -c new.c
clean :
	rm new.o 
cleanall :
	rm new new.o

I recieved the following errors

[e@localhost e]$ man gcc
[e@localhost e]$ cd programing
[e@localhost programing]$ make
cc -o new new.o
new.o: In function `main':
new.o(.text+0x14): undefined reference to `sqrt'
collect2: ld returned 1 exit status
make: *** [new] Error 1
[e@localhost programing]$

Then I tried

[e@localhost programing]$ gcc -o new new.c
/tmp/ccDwfMtN.o: In function `main':
/tmp/ccDwfMtN.o(.text+0x14): undefined reference to `sqrt'
collect2: ld returned 1 exit status
[e@localhost programing]$

THIS DOESN'T WORK PROPERLY
please tell me why,
I'm running Mandrake Linux release 8.2 for i586
            Kernel 2.4.18-6 mdk on an i868
with gcc-2.96


Please, 
send me answer as soon as posible.

-----------------------------------------------------------------
http://kino.GBG.bg - НАЧАЛО | КИНО ПРЕМИЕРИ | ПРОГРАМАТА | НОВИНИ | DVD И ВИДЕО | КИНО ИСТОРИЯ


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]