What can be the error in linking.

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone,
I am trying to port ucos ii on My atmega128 kit. I am using the IAR compiler for that, since the port that they have given is in IAR. I have made the changes in the rest of the code to remove error during compilation, but there is just 1 error in linking and i feel i am almost there.

all the files got compiled successfully. The error is

“Error[e27]: Entry "OSSemAccept" in module os_sem ( C:\Documents and Settings\SHREE\Desktop\Embedded  

Systems\testrtos\Debug\Obj\os_sem.r90 ) redefined in module ucos_ii ( C:\Documents and Settings\SHREE\Desktop\ Embedded Systems\testrtos\Debug\Obj\ucos_ii.r90 )”

Now I will explain what it is. The os_sem.c file is using definitions from ucos_ii.h file. Now there is some cross reference in the ucos_ii.h so what happens at compile time everything compiles without error, but while linking the error is detected. I have used IAR compiler. Can anyone try to investigate why this is happening. I have tried to trace the code, but with in vain. I have attached the whole project.

Details:
uc: Atmega128
Compiler: IAR embedded workbench for AVR 4.30A

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the answer is in the error message. It's telling you that a symbol is multiply defined from os_sem.c and ucos_ii.c

This comes as no surprise whatsoever because, for some quite bizarre reason, ucos_ii.c just contains a load of #include statements that are including every other .c file in the project. So they are all getting built twice and hence all the symbols they define are going to give "redefined" link errors.

You may want to take a step back, get yourself a good book about programming in C and really think why on earth you'd ever want to #include a .c file!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Stop cheating Cliff, that was a valid post!!

Regards,
Steve A.

The Board helps those that help themselves.