You are not logged in.

#1 2010-12-10 14:25:55

blackcobra
Member
From: Ireland
Registered: 2010-12-07
Posts: 4

[SOLVED] <math.h> programming c

hey, having a bit of trouble here! a simple example would be:

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

main()
{
double k=2.33;
printf("%lf\n", sin(k));
}

when i compile this with gcc
i get an error, undefined ref to sin?
its seem not to be taking assigned arguments (???)

is there extra packages i need to download?
sorry, im new to arch..

Last edited by blackcobra (2010-12-10 14:40:50)


Dan

Offline

#2 2010-12-10 14:27:13

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,487
Website

Re: [SOLVED] <math.h> programming c

Add "-lm" to your gcc line.

Offline

#3 2010-12-10 14:31:55

blackcobra
Member
From: Ireland
Registered: 2010-12-07
Posts: 4

Re: [SOLVED] <math.h> programming c

thanks!! i forgot!

Last edited by blackcobra (2010-12-10 14:52:16)


Dan

Offline

Board footer

Powered by FluxBB