I have 3 files (.h and .cpp)
MainGame.h
MyFile1.h <- includes MyClass1
MyFile2.h
MainGame.h contains public static vector of <MyClass1>, which is located in MyFile1.h.
Now, MainGame.h has to #include both MyFile1.h and MyFile2.h files.
But when I want to use this static vector from "MainGame.h", there is no way I can do it (#inlcude "MainGame.h" in MyFile2.h for example)without getting bunch of linking and unresolved externals errors.
I am missing something? This is the first time I have came across such a blocker.
I also tried to only forward declare MyClass1, but no result.
*every header has #pragma once to rpevent circular includes
EDIT: I forward declared the classes I needed in header files and included header files I needed in .cpp and it seems compiler is okay and I can get what I need.
If you want to use a resource (in this case a vector of MyClass1) across multiple files shouldn't you use 'extern' in MyClass1 and then define it once in myFile2 so that it only exists in one compilation unit?