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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/11 10:18
Read: times


 
#181322 - Fundamental 'C' programming error!
Responding to: ???'s previous message
Praveen Kumar said:
... We defined numerical constants in the code ... These are defined seperately in the individual header files of the modules, and they are used in almost 150 locations in each file.

That is a fundamental 'C' programming error - nothing to do with Keil or banking!

You should not place data definitions in header files!

If a header file contains definitions, and you #include it in more than one (ie, multiple) .c files, then that will give you a definition in each .c file - ie, multiple definitions!!

Your headers should contain only extern declarations;
Each definitions should be in exactly one .c source file.

http://c-faq.com/decl/decldef.html


List of 15 messages in thread
TopicAuthorDate
Multiple public definitions in code banking            01/01/70 00:00      
   single const byte in code            01/01/70 00:00      
      The meaning of 'const' in ANSI 'C'            01/01/70 00:00      
         Yes            01/01/70 00:00      
            Keil C51 isn't a C++ compiler            01/01/70 00:00      
      Coding Standard Rules - Netrino            01/01/70 00:00      
         Rule #2 is a bit broken or at least incompletely formulated            01/01/70 00:00      
         issue with #define usage            01/01/70 00:00      
      extern const code declaration            01/01/70 00:00      
         Insufficient detail            01/01/70 00:00      
         Conceptually wrong            01/01/70 00:00      
            Thanks, it's working !            01/01/70 00:00      
               Why?            01/01/70 00:00      
                  correction            01/01/70 00:00      
   Fundamental 'C' programming error!            01/01/70 00:00      

Back to Subject List