L6218E: Undefined symbol - Can't work out what it means

Full error code (at compile time)

[Error] @0,0: L6218E: Undefined symbol Fifo<Data, 1000>::addToBuffer(Data) (referred from BUILD/NUCLEO_F429ZI/ARMC6/main.o).

Code:

fifo.h

template <typename T, int Size>
class Fifo{
    public:
        T buffer[Size];

        int in = 0;
        int out = 0;
        int spaceInBuffer = Size;

        int IncrementIn();
        int IncrementOut();
        
        void addToBuffer(T);
        T popOffBuffer();
};

fifo.cpp (cut out the rest of the class as it probably isn’t relevant)

template <typename T, int Size>
void Fifo<T, Size>::addToBuffer(T obj){
    buffer[IncrementIn()] = obj;
}

main.cpp (here is where I use the fifo class

#include "fifo.h"
#define BUFFERSIZE 1000
Fifo<Data, BUFFERSIZE> azureBuffer;
Fifo<Data, BUFFERSIZE> cardBuffer;

EDIT:

The problem was that the template class (Fifo) has to be fully implemented in the header file. Not defined in the header and then implemented in the cpp file. Explaination

Hello Oliver,

Maybe it helps. The following code compiles with no errors.
main.cpp:

#include "mbed.h"

template<typename T, int Size>
class Fifo
{
public:
    T   buffer[Size];

    int in = 0;
    int out = 0;
    int spaceInBuffer = Size;

//    int IncrementIn();
//    int IncrementOut();

    void addToBuffer(T);
//    T popOffBuffer();
};

template<typename T, int Size>
void Fifo<T, Size>::addToBuffer(T obj)
{
    buffer[0] = obj;
}

#define BUFFERSIZE  1000
typedef int Data;

DigitalOut led1(LED1);
Fifo<Data, BUFFERSIZE> azureBuffer;
Fifo<Data, BUFFERSIZE> cardBuffer;

int main()
{
    while (true) {
        led1 = !led1;
        ThisThread::sleep_for(500ms);
    }
}