Имеется класс Point, определенный в заголовочном файле Header.h, все методы, конструкторы, деструкторы описаны там.
При попытке собрать проект все время выбивает ошибку LNK2001 и LNK1120, подскажите пожалуйста в чем может быть проблема.
Header.h:
#include <iostream>
using namespace std;
class Point
{
private:
static int _freeID;
const int _pointID;
double _x;
double _y;
public:
Point(const double &x = 0, const double &y = 0):
_x(x), _y(y), _pointID(++_freeID){
}
Point(const Point& u) :
_x(u.x()), _y(u.y()), _pointID(++_freeID) {}
~Point(void) {
return;
}
Point& operator=(const Point &u) {
_x = u.x();
_y = u.y();
return *this;
}
double& x(void) {
return _x;
}
double& y(void) {
return _y;
}
const double& x()const {
return _x;
}
const double& y()const {
return _y;
}
};
ostream& operator<<(ostream& os, const Point& u) {
os << '(' << u.x() << ', ' << u.y() << ')';
return os;
}
const Point operator+(const Point& a, const Point& b) {
return Point(a.x() + b.x(), a.y() + b.y());
}
Point& operator+=(Point&, const Point&);
const bool operator==(const Point& a, const Point& b) {
if (a.x() == b.x() && a.y() == b.y())
return true;
else
return false;
}
const bool operator!=(const Point& a, const Point& b) {
if (a.x() == b.x() && a.y() == b.y())
return false;
else
return true;
}
Main.cpp:
#include "stdafx.h"
#include "Header.h"
int main()
{
Point a(1, 2);
cout << a;
system("pause");
return 0;
}