Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Wth?

Name: Anonymous 2011-08-15 5:38


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

int main()
{
    double phi = (1 + sqrt(5))/2;
    int n = 12;
    n = (pow(phi,(double)n) - pow((1 - phi),(double)n))/sqrt(5);
    printf("%d \n", n);
}


gcc --std=c99 name.c

undefined reference to 'pow'
undefined reference to 'pow'

gcc name.c

undefined reference to 'pow'
undefined reference to 'pow'

What am I doing wrong? The standard library is install and the man pages do have a description of double pow(double, double)

Name: Anonymous 2011-08-15 5:49

>>11
check 'em doubles

Name: Anonymous 2011-08-15 6:04

Ye Olde Devcpp and Code::Blocks compile it just fine...

Name: Anonymous 2011-08-15 6:05

Name: Anonymous 2011-08-15 6:41

>>4
DOWNGOATED

Name: Anonymous 2011-08-15 6:48

RTFM, dumbass.
Synopsis
#include <math.h>
double pow(double x, double y);
float powf(float x, float y);
long double powl(long double x, long double y);


Link with -lm.

Don't change these.
Name: Email:
Entire Thread Thread List