The problem is the include/encMinim.h file.
In line 14 to 52 it declares the class encMinim. That’s okay.
But then in lines 54 to 171 defines all the functions of that class. That’s not okay because it’s in the .h file. That header .h file gets included by many .cpp files, so many .cpp files will have a copy of the class definition of encMinim. Therefore, when the firmware is linked together, there will be many copies of the class and functions definitions. But there can only be one.
What you need to do is to properly factor the encMinim class into header (.h file, only declarations) and source (.cpp file, #includes header file, only definitions). This is just the way C/C++ works.
The post Header files and good practice. Harder than I thought - #2 by maxgerhardt shows how.
So, it’s easy:
- Create a new file
src/encMinim.cpp - Start it with
#include "encMinim.h" - Then cut out lines 54 to 171 from encMinim.h and paste it into encMinim.cpp