Problems recycling c++ lib with templated class for Arduino I have a header &amp; cpp file located in Arduino\libraries\Parentfolder\Header&amp;Cpp. Arduino IDE recognizes my lib (the class is color coded &amp; Sketch->include library->MyLibrary shows in the dropdown menu and #includes properly).

Problem: Arduino IDE gives undefined reference to MyClass . . . error in my sketch for every reference of the class including function calls. The function fully in other IDEs as header/cpps so I don't think pasting the cody is necessary -- what could I be missing? I've read a million Stack Exchange posts with similar error/watched a million YouTube guides on writing Arduino libs and I can't seem to find the differentiating factors that would make my code not work for Arduino IDE.

tl;dr what are the reasons that a working c++ library (self-made) would not work with Arduino IDE?

/e

Queue.h
#ifndef Queue_h
#define Queue_h

#include "Arduino.h"

template &lt;typename T&gt;
class Queue
{
  public:
    typedef struct node
    {
      T data;
      node * next = nullptr;
    } * nodePtr;

    nodePtr head; // = nullptr;
    nodePtr tail; // = nullptr;
    nodePtr curr; // = nullptr;
    nodePtr temp; // = nullptr;

    unsigned int counter;

    Queue();
    void push(T);
    T&amp; peek();
    T pop();
    int size();
    bool isEmpty();
    void clear();
};

#endif


Queue.cpp

#include "Arduino.h"
#include "Queue.h"

template &lt;typename T&gt;
Queue&lt;T&gt;::Queue()
{
    nodePtr head = nullptr;
    nodePtr tail = nullptr;
    nodePtr curr = nullptr;
    nodePtr temp = nullptr;

    counter = 0;
}

template &lt;typename T&gt;
void Queue&lt;T&gt;::push(T data)
{
  if (head == nullptr)
  {
    head = new node;
    head-&gt;data = data;
    tail = head;
  }
  else
  {
    temp = head;
    head = new node;
    head-&gt;data = data;
    head-&gt;next = temp;    
  }
  counter ++;
}

template &lt;typename T&gt;
T&amp; Queue&lt;T&gt;::peek()
{
  if (head == nullptr)
  {
    return 0;
  }
  return head-&gt;data;

}

template &lt;typename T&gt;
T Queue&lt;T&gt;::pop()
{
  // Empty
  if (head == nullptr)
  {
    return 0;
  }

  // Head = tail
  if (head == tail)
  {
    T data = head-&gt;data;
    delete head;
    return data;
  }

  // Size &gt; 1
  curr = head;
  while (curr-&gt;next != tail)
  {
    curr = curr-&gt;next;
  }
  T data = curr-&gt;next-&gt;data;  
  tail = curr;
  curr = curr-&gt;next;
  delete curr;
  counter --;
  return data;
}

template &lt;typename T&gt;
int Queue&lt;T&gt;::size()
{
  return counter;
}

template &lt;typename T&gt;
bool Queue&lt;T&gt;::isEmpty()
{
  if (counter ==0)
  {
    return true;
  }
  return false;
}

template &lt;typename T&gt;
void Queue&lt;T&gt;::clear()
{
  while (head-&gt;data != nullptr)
  {
    temp = head-&gt;next;
    delete head;
    head = temp;    
  }
  if (head == nullptr)
  {
    return;
  }
  delete head;
  return;
}


.ino

. . .
Queue&lt;float&gt; avgQueue;
. . .


error

. . . In function `__static_initialization_and_destruction_0':
. . . undefined reference to `Queue&lt;float&gt;::Queue()'


SOLVED:

Combining the .cpp contents in the .h and removing the .cpp worked.
SOLVED:

Putting the .cpp contents in the .h and removing the .cpp from the lib folder entirely worked.