Syntax error which isn't an error? (Confused)

Started by
3 comments, last by JoshuaWaring 10 years, 10 months ago

I'll give a bit of background first. I was trying to have a ResourceManager and a MessageManager completely global but I got redefined errors, so I start to use static values. Which is when I learn that static values have a file scope not a global scope (didn't know file scope existed). Finally I now have a structure containing all global values, I create it at the start of the program and call a function to pass it's instance to the classes contained inside of it, so the global variables can access the globals as well and that's were this occurs

[attachment=16376:CaptureErrors.PNG]

If someone has a better method for doing what I'm trying please don't hesitate it explain. Opening my mind to multiple methods is exactly what I need.

Thank you for any help and replies smile.png

Advertisement

You probably have a circular header dependency. Read more about how to structure your headers here

However, the fact that the Global_Values_Structure and the MessageManager / ResourceManager are mutually dependant indicates you may have a poorly modularised design. Clarifying the design will probably better than merely getting what you have to compile.

I would have to see the various classes involved to offer any specific suggestions.

You're completely right in what's wrong. I was just trying to resolve the issue, to no avail.

Looks like a good article and a restructuring will be the solution.

Putting all includes in stdafx.h probably isn't a good idea biggrin.png

You probably should not be placing headers you wrote yourself into stdafx.h, not until you know the implications anyway.

Yeah, I've completely stripped all custom headers in the stdafx at first I though of making a Include.h for the includes, but that was just the same thing Obvious -facepalm-
So I've made sure all classes only call what they need and focused on reducing the reliance each class has on each other. practically to nill.

Moral of the story, be smart with your includes to avoid unneeded includes and loops. (It compiles :D)

This topic is closed to new replies.

Advertisement