Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Joshhua5   Members   -  Reputation: 439

Like
0Likes
Like

Posted 17 June 2013 - 11:08 AM

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

 

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



Sponsor:

#2 rip-off   Moderators   -  Reputation: 8222

Like
4Likes
Like

Posted 17 June 2013 - 11:56 AM

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.



#3 Joshhua5   Members   -  Reputation: 439

Like
0Likes
Like

Posted 17 June 2013 - 12:06 PM

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



#4 rip-off   Moderators   -  Reputation: 8222

Like
1Likes
Like

Posted 17 June 2013 - 12:09 PM

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



#5 Joshhua5   Members   -  Reputation: 439

Like
1Likes
Like

Posted 17 June 2013 - 12:32 PM

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)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS