Put only function prototypes and extern object declarations in header files, such as
// A.h file
extern void foo();
extern int f1;
Now, in one and only one *.cpp file you have to declare the same without the extern keyword.
// A.cpp file
#include "A.h"
int f1 = 0;
void foo()
{
}