Error with a simple sqrt

G

gamo

Hello everybody


I have a simple program that compiles and run under gcc 4.2.4

Now I have gcc 4.8.1 and it's much strict


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

unsigned long int x,y;


int main (void){
y = 12345;
x=0;

if (x < sqrt(y)) return 0;
return 1;
}


It says 'undefined reference to sqrt' or something similar in spanish.

ld exit with error 1

What can I do for being accepted by the compiler?

TIA

PS: I try to ijnclude stdlib.h but doesn't seem related
 
K

Keith Thompson

gamo said:
I have a simple program that compiles and run under gcc 4.2.4

Now I have gcc 4.8.1 and it's much strict


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

unsigned long int x,y;


int main (void){
y = 12345;
x=0;

if (x < sqrt(y)) return 0;
return 1;
}


It says 'undefined reference to sqrt' or something similar in spanish.

ld exit with error 1

What can I do for being accepted by the compiler?

TIA

The comp.lang.c FAQ is at http://www.c-faq.com/.

You've just asked question 14.3.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top