By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,438 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Struct initialization error: multiple definition on TuBL

P: n/a
Can anyone tell me why this piece of program:


Expand|Select|Wrap|Line Numbers
  1. typedef struct
  2. {
  3.     int s0;
  4.     int s1;
  5. }MyBL;
  6.  
  7.  
  8. MyBL TuBL = {22, 23};
  9.  
  10.  
gives a compiler/linker error "multiple definition on TuBL"
Oct 9 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 2,396
Does this snippet of code occur in a header file? If so, then TuBL is defined each time the header file is included.

Is it possible that some other global symbol called TuBL exists somewhere else in your code? The other instance of TuBL might be a different type and be for a completely different purpose. It might even be a function name.

You could sidestep global namespace conflicts if TuBL were defined static; that is, as a local variable.
Oct 9 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.