I'm not quite sure what to do here.. whenever I try to compile my OS with my linker script it claims every function is defined multiple times. I have all of them defined in 3 .h files.
Here's my source code:
http://www.megaupload.com/?d=BF2KKBSB
(lot of files)
Here's the log from the command prompt:
http://charlesgranville.awardspace.com/cmdpromptlog.txt
Anyone have any ideas why it does that?
I'm guessing it's something incredibly stupid I did.. seems most likely.
LD linker claiming multiple definitions of functions
Re:LD linker claiming multiple definitions of functions
;Dcg123 wrote:I'm guessing it's something incredibly stupid I did.. seems most likely.
You should not define your functions in header files, but just declare them That's most likely the reason for these linker errors (I haven't looked at your code).
Re:LD linker claiming multiple definitions of functions
Yep.. that was the problem. Thanks. ;D
Re:LD linker claiming multiple definitions of functions
Nope... still doing it, actually... didn't scroll up far enough. :/
Re:LD linker claiming multiple definitions of functions
Do you have include guards against multiple inclusions?
file myheader1.h:
file myheader2.h:
file myheader1.h:
Code: Select all
#ifndef _MYHEADER1_H
#define _MYHEADER1_H
/* Your code here */
#endif
Code: Select all
#ifndef _MYHEADER2_H
#define _MYHEADER2_H
/* Your code here */
#endif
Every good solution is obvious once you've found it.
Re:LD linker claiming multiple definitions of functions
Ok, I found the problem.. I didn't need to add the filenames to the command for the linker, I had already specified them in the linker script.. so it was linking everything twice. xD
Thanks for all the help. ;D
Thanks for all the help. ;D