Link error in CodeWarrior for a HC08 device

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Link error in CodeWarrior for a HC08 device

1,068 Views
IvanWagner
Contributor I
Hi to everyone,
 
I'm trying to compile some sort of software using CodeWarrior for a HC08 device but I'm having problems with the Linker. In fact I have this header file in which there's the following code:
 
Code:
#ifndef HEADER_H#define HEADER_H/*Register declarations*/#endif

 This to prevent the linking errors for the header file being included more than once. Even though I've included this code to prevent this, I get a L1818 linking error saying that many registers were actually declared more than once.
I'm sure that all these registers are declered only once in the previous mentioned header file...
 
Is there some sorf of overriding command that ignored my #ifndef code? Is there a way to do something in IDE level?
 
Thanks for any reply,
 
Ivan.

 
Labels (1)
0 Kudos
1 Reply

233 Views
CrasyCat
Specialist III
Hello
 
Make sure to have only external declaration for your registers in the .h file.
For example
  extern unsigned char PORTA;
 
You need a separate .C source file to hold the actual definition of the registers.
For example
  unsigned char PORTA;
 
 This is a standard programming rule, when you are using modular programming.
 
You can check the register definition file delivered with CodeWarrior to check how this is done.
 
CrasyCat
0 Kudos