I'm starting now in this programmer's life and I'm trying to run a program for physics class but at the time of compiling the file I'm getting this message back ... reach.c :( .text + 0x68): undefined reference to cos'
alcance.c:(.text+0x93): referência indefinida para
sin '
collect2: error: ld returned 1 exit status
I'm using emacs ... gcc -lm -o scope reach.c, Should I send other information ??
This is the part that refers to the consen and the bosom
rx = 0.0;
ry = 0.0;
vx = v0 * cos (theta * 3141592 / 180.0);
vy = v0 * sin (theta * 3.141592 / 180.0);
Should I do the double cos, and double without?
#include <stdio.h>
#include <math.h>
main ()
{
double ry;
double rx;
double vx;
double vy;
double ax;
double ay;
double dt;
double t;
double g;
double v0;
double theta;
double b; // [1/ms]coeficiente de arrasto
double dtheta; // angulo de lancamento
g=-10;
dt=0.1;//
v0=100;// velocidade inicial
dtheta=1;// angulo de lançamente
b=1;// coeficiente de arrato
for (theta=0;theta<=90;theta=theta=dtheta){
rx=0.0;
ry=0.0;
vx=v0*cos(theta*3141592/180.0);
vy=v0*sin(theta*3.141592/180.0);
for(t=0;t<=500;t=t+dt){
if(ry<0.0)break;
ax=0.0-b*vx;
ay=-g-b*vy;
rx=rx+vx*dt;
ry=ry+vy*dt;
vx=vx=ax*dt;
vy=vy+ay*dt;
}
#include <math.h>
printf("%f %f %f %f %f %f\n",theta,t,rx,ry,vx,vy);
}
return 0;
}