I am writing a code to work with vectors in C++. I've got 3 files: main.cpp, Vektor.cpp and Vektor.h Now I want to call a static funktion in main, which is implemented in Vektor.cpp and declarated in Vektor.h. "test" and "test2" are two instances of the class Vektor. Eclipse throws an Error out, but i do not know why; it says
Multiple markers at this line - Function 'addieren' could not be resolved - 'addieren' was not declared in this scope - Invalid overload of 'endl' - Line breakpoint: main.cpp [line: 28]
Where is the mistake? The "Vektor.h" is included. Here are the necessary cuttings:
main.cpp:
// ...
cout << "Summe: " << addieren(test,test2) << endl;
Vektor.cpp:
Vektor Vektor::addieren(Vektor vektor1, Vektor vektor2)
{
Vektor vektorSumme;
vektorSumme.set_x(vektor1.get_x() + vektor2.get_x());
vektorSumme.set_y(vektor1.get_y() + vektor2.get_y());
vektorSumme.set_z(vektor1.get_z() + vektor2.get_z());
return vektorSumme;
}
Vektor.h:
class Vektor
{
//...
public:
//...
static Vektor addieren(Vektor vektor1, Vektor vektor2);
Thanks for helping!!