Witam wszystkich.Mam problem z uruchomieniem poniższego programu.Wyskakuje mi błąd
In file included from Rowny.cpp:1,
from main.cpp:4:
wektor3w.h:2: error: redefinition of `class wektor3w'
Wektor3w.h:2: error: previous definition of `class wektor3w'
i kompletnie nie wiem o co chodzi.W C++ siedze dopiero od trzech tygodnii.
Pozdrawiam i dzięki za wszelką pomoc z góry.
Header Files
wektor3w.h
class wektor3w
{
friend bool Rowny(const wektor3w&,const wektor3w&);
public:
wektor3w(float,float,float);
wektor3w();
~wektor3w();
void Wyswietl();
float x;
float y;
float z;
};
wektor3w.cpp
#include <iostream.h>
#include"wektor3w.h"
wektor3w :: wektor3w(float c1 ,float c2 ,float c3)
{
x=c1, y=c2, z=c3;
}
wektor3w :: wektor3w()
{
x = 0.0;
y = 0.0;
z = 0.0;
}
wektor3w :: ~wektor3w(){}
void wektor3w :: Wyswietl()
{
cout <<"Wspolrzedna x : " << x << " Wspolrzedna y : " << y << " Wspolrzedna z : " << z << "\n" ;
}
Source Files
Rowny.cpp
#include"wektor3w.h"
bool Rowny(const wektor3w & ob1,const wektor3w & ob2){
if ((ob1.x == ob2.x) && (ob1.x == ob2.x) && (ob1.x == ob2.x) == 1 ) return true ;
else return false;
}
main
#include <iostream.h>
#include "Wektor3w.h"
#include "Rowny.cpp"
int main()
{
wektor3w wektor1(10,20,30);
wektor1.Wyswietl();
wektor3w wektor2(10,20,30);
wektor2.Wyswietl();
wektor3w wektor3;
wektor3.Wyswietl();
bool por = true;
por = Rowny(wektor1,wektor2);
}