Your problem is not with PIO but with your code. You are having a header file which instantiates VARIABLES in every CPP file it is included, thus duplicating variables like crazy.
Look at your enregistrement.h
file:
#ifndef ENREGISTREMENT
#define ENREGISTREMENT
/* .. */
File fichierSD;
unsigned long position_fin_fichier;
float compteur;
float tempMinObs;
unsigned long tempMinTime;
float tempMaxObs;
unsigned long tempMaxTime;
float tempMoyObs;
float temperature
float tempSomme;
Now every time your #include "enregistrement.h
that file (e.g. in main.cpp
and in enregistrement.cpp
), your file gets a copy of these variables.
What you most probably want is that these are global variables which only exist once. For that, your header file must declare each variable to be extern
. You then have to define these variables once in one CPP file.
So, e.g. in enregistrement.h
the line File fichierSD;
becomes extern File fichierSD;
, while in some .cpp file (say, e.g. enregistrement.cpp), you place File fichierSD;
as a global variable on top of the file. Do that with all your variables until the linker doesn’t complain about duplicate definitions anymore.