I have a C++ DLL with 3 classes in it. I added a static boolean variable to my “stdafx” header file (since all of my classes include it) and am trying to use it. While all of my classes see my variable, they each seem to have a different instance of it. If I set the variable to true in once class then I’ll notice that it’s false in another class. Is there any way that I can create a variable that can be used across all classes only within the DLL?
Share
Well, you labelled it
static, so that’s what happens. Instead, label itexternin headers and define it in one TU.And don’t modify
stdafx; it’s not yours. Use your own shared headers.