having problems with math.h
From: damian birchler (damian_birchler_at_bluewin.ch)
Date: 09/12/04
- Previous message: Konrad M. Kokoszkiewicz: "Re: mplayer crashes the system"
- Next in thread: Simon Barner: "Re: having problems with math.h"
- Reply: Simon Barner: "Re: having problems with math.h"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Sep 2004 10:24:59 -0700
Im having problems trying to compile with gcc. When compiling I get a
linker error which says "undefined reference to floor".
My programme looks like this:
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
double mcp1(double n, double m);
printf("%f\n", mcp1(3.0, 1000.0) + mcp1(5.0, 1000.0));
return 0;
}
double mcp1(double n, double m) {
double floor(double x);
return (m * (floor(m/n) + 1.0)) / 2.0;
}
It's purpose is to sum all natural multiples of 3 and 5 up to 1000.
Thanks in advance
- Previous message: Konrad M. Kokoszkiewicz: "Re: mplayer crashes the system"
- Next in thread: Simon Barner: "Re: having problems with math.h"
- Reply: Simon Barner: "Re: having problems with math.h"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|