Basically, I have to build two archives one is named Ponto2D.hpp and the other Ponto2D.cpp
Ponto2D.hpp:
#ifndef PONTO2D_H
#define PONTO2D_H
#include <iostream>
#include <cmath>
using namespace std;
struct Ponto2D{
double posx, posy;
Ponto2D();
Ponto2D(double, double);
double calcular_distancia(Ponto2D* ponto);
};
#endif
Ponto2D.cpp:
#include "Ponto2D.hpp"
#include <iostream>
#include <cmath>
Ponto2D::Ponto2D(double x, double y){
posx = x; posy = y;
}
double Ponto2D::calcular_distancia(Ponto2D* ponto){
double distx = abs(this->posx - ponto->posx); //
double disty = abs(this->posy - ponto->posy);
return sqrt(distx * distx + disty * disty);
}
And when I try to use it's commands i get this error:
undefined reference to `Ponto2D::Ponto2D(double, double)' Any ideias of how to solve this?