First, you need to pick up the place where your vectors should be defined. Let's say you choose A.cpp .
In A.cpp (in only one file - defining the same object in several files will result in the error of several specific characters) define vectors as global variables:
vector<uint64_t> V1; vector<uint64_t> V2;
In B.cpp (and in all other files from which you want to access V1 and V2 ) declare vectors as extern . This will tell the linker to look elsewhere for real objects:
extern vector<uint64_t> V1; extern vector<uint64_t> V2;
Now, at the linking stage, V1 and V2 from B.cpp will be connected to V1 and V2 from A.cpp (or if these objects are defined ).
source share