Sign in to follow this  
JoshuaWaring

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

Recommended Posts

JoshuaWaring    1359

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

Share this post


Link to post
Share on other sites
rip-off    10976

You probably have a circular header dependency. Read more about how to structure your headers [url="http://www.gamedev.net/page/resources/_/technical/general-programming/organizing-code-files-in-c-and-c-r3173"]here[/url]

 

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.

Share this post


Link to post
Share on other sites
JoshuaWaring    1359

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

Share this post


Link to post
Share on other sites
JoshuaWaring    1359

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)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this