In Program.h is ProgramItems ref class which has static Window ^window (form). I want to include it in Search.h (user control), so from it I can add controls to window and other stuff. But, when I include "Program.h" in Search.h i get different errors on compile. Basicly all I want to do is to have global window variable that works for any usercontrol in my program.
Here is my code:
Not working :(. Microsoft Visual Studio Express 2015. When I include Window in other classes there is no problem, but if I include it in Window.h then this error happens. Well I don't actually include Window.h in window.h, I include search.h which included program.h which includes window.h.
I created a VS 2015 CE solution with the code you showed and got it working. However some code was missing so it shows only an empty window. Maybe you can add the missing code.
I tried your code and it worked perfectly. But then I saw there was no "include Program.h", so I wrote it and got the same error as in my original project. Try it.
Include guards and #pragma once solve the problem of #including a file multiple times. Neither one resolves circular dependencies. Did you visit the SO link?