Jump to content
  • Advertisement
Sign in to follow this  
noatom

static variables name clash

This topic is 1912 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I have an exercise in my book that says: prove that file static variables in header files don't clash with each other when included in more than one cpp file.

 

So I have a header file that contains just: int i=10;

and 2 cpp files that include that header file.

 

When i try to compile->fatal error LNK1169: one or more multiply defined symbols found

Share this post


Link to post
Share on other sites
Advertisement

Also, it's probably not a good idea to call a global variable "i". Such a variable name is very common for loops or other things.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!