I'm learning c++ from the book starting out with c++ and I'm in the chapter of oop. There is an example in the book that I tried to do ,but I get a compile error. the error says undefined reference to 'Rectangle::setLength(double) and it says this error for every function in the class.
I already checked my code with the book and its exactly the same. Can you help me find the error? there's probably something I'm not seeing. also all of the files are in the same folder and I'm using codeblocks.

header file
Code:
#ifndef RECTANGLE_H
#define RECTANGLE_H

class Rectangle
{
    private:
        double length;
        double width;
    public:
        bool setLength(double);
        bool setWidth(double);
        double getLength();
        double getWidth();
        double getArea();
};
#endif
rectangle.cpp
Code:
#include "rectangle.h"

bool Rectangle::setLength(double len)
{
    bool validData = true;
    if (len >= 0)
        length = len;
    else
        validData = false;
    return validData;
}

bool Rectangle::setWidth(double w)
{
    bool validData = true;
    if (w >= 0)
        width = w;
    else
        validData = false;
    return validData;
}

double Rectangle::getLength()
{
    return length;
}

double Rectangle::getWidth()
{
    return width;
}

double Rectangle::getArea()
{
    return length * width;
}
main file
Code:
#include <iostream>
#include "rectangle.h"
using namespace std;

int main()
{
    Rectangle box;
    double boxLength, boxWidth;

    cout << "This program will calculate the area of a rectangle.\n";
    cout << "what is the length? ";
    cin >> boxLength;
    cout << "what is the width? ";
    cin >> boxWidth;

    if (!box.setLength(boxLength))
        cout << "invalid box length entered.\n";
    else if (!box.setWidth(boxWidth))
        cout << "invalid box width entered.\n";
    else
    {
        cout << "\nHere is the rectangle's data: \n";
        cout << "Length: " << box.getLength() << endl;
        cout << "width : " << box.getWidth() << endl;
        cout << "Area  : " << box.getArea() << endl;
    }
    return 0;
}