Unresolved external symbol

Hello everyone ! :) I have a little problem, which i can't figure out. I am making a function which detects rectangle vs. rectangle collision. I get an error "unresolved external symbol" (full error at bottom). I have a few more functions in this class, but error is thrown only to this function. Please help if you can :)

code (.h):
1
2
3
4
5
6
7
8
9
10
11
class Box
{
public:
	vector2 mMin;
	vector2 mMax;
	Box (vector2 min, vector2 max) : mMin(min) , mMax(max) {};
	~Box();

	inline bool intersect(const Box & b) const;
	void		box_draw();
};


code (.cpp) (only the failing function):
1
2
3
4
inline bool Box::intersect(const Box & b) const
{
	return b.mMax.x > mMin.x && b.mMin.x < mMax.x && b.mMax.y > mMin.y && b.mMin.y < mMax.y;
}


error:
LNK2001: unresolved external symbol "public: bool __thiscall Box::intersect(class Box const &)const
C++11 ยง3.2/3
An inline function shall be defined in every translation unit in which it is odr-used.

So ... if you want the function to be inline you should define it in the header file.
Thank you, Peter. I didn't knew that.
Topic archived. No new replies allowed.