Here's my code:
myFoo.bar = 2;
duplicate symbol _myFoo in main.o & A.o
You define the global variable in header and it breaks the one definition rule.
Each TU where you include the header will have its own copy of the object.
You need to use
extern Foo myFoo;
#include "A.h" Foo myFoo;