Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/19/03 09:32
Read: times


 
#58996 - RE: RE to SUSHIL and THE SOLUTION
Responding to: ???'s previous message
I'm assuming you want these variables to be global, ie to be in scope and visible in all your source files?

If that is the case you should define each variable exactly once in one .c file, eg:

unsigned char a;
or, if you want to initialise it:
unsigned char a=5;

Then, in exactly one .h file you should use:

extern unsigned char a; //Note: no initialiser

This .h file should be #included in every .c file that references the variable.

What you have done by declaring the varaibles as static is made them NOT extern, ie they aren't exported to the linker. This means that you now have multiple, separate copies of the variables, one in each .c file. This certainly stops the linker warnings but is not, I think, what you want.

List of 20 messages in thread
TopicAuthorDate
Problem when I split Source Code            01/01/70 00:00      
   RE: Problem when I split Source Code            01/01/70 00:00      
      Downloading the File...            01/01/70 00:00      
         RE: Downloading the File...            01/01/70 00:00      
         aaaaaaaaaaarrrrrrrrrgggggggggghhhhhhhhhh            01/01/70 00:00      
            RE: aaaaaaaaaaarrrrrrrrrgggggggggghhhhhhhhhh            01/01/70 00:00      
               RE: aaaaaaaaaaarrrrrrrrrgggggggggghhhhhhhhhh            01/01/70 00:00      
   RE: Problem when I split Source Code            01/01/70 00:00      
      RE: Problem when I split Source Code            01/01/70 00:00      
   RE: Problem when I split Source Code            01/01/70 00:00      
   RE: Header Files            01/01/70 00:00      
      RE to SUSHIL and THE SOLUTION            01/01/70 00:00      
         RE: RE to SUSHIL and THE SOLUTION            01/01/70 00:00      
            RE: RE to SUSHIL and THE SOLUTION            01/01/70 00:00      
         RE: static            01/01/70 00:00      
            Thanks Donald and Andy            01/01/70 00:00      
               Important Lesson            01/01/70 00:00      
            Structure Still not working !!            01/01/70 00:00      
               RE: Structure Still not working !!            01/01/70 00:00      
                  Eureka.. :)            01/01/70 00:00      

Back to Subject List