Error with a simple sqrt

Discussion in 'C Programming' started by gamo, Oct 23, 2013.

  1. gamo

    gamo Guest

    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;

    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?


    PS: I try to ijnclude stdlib.h but doesn't seem related
    gamo, Oct 23, 2013
    1. Advertisements

  2. The comp.lang.c FAQ is at

    You've just asked question 14.3.
    Keith Thompson, Oct 23, 2013
    1. Advertisements

  3. gamo

    gamo Guest

    El 23/10/13 02:35, Keith Thompson escribió:
    Thank you very much. I will read the entire FAQ
    gamo, Oct 23, 2013
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.