Page 1 of 1

multiple definition

Posted: Mon Jun 28, 2004 8:30 am
by Link
This might be more of a C question but since I only have had this problem when working with OSes I though I could ask it here..
I have a main-file with the main-method...and then I got some IO functions to write/read ports.. works fine..
then I tried to put the in/out functions in a file called IO.c and I included this file in the main-file.. (like you allways do).. but when I try to link I get this message:
kernel.o(.text+0x0):kernel.c: multiple definition of `_out'
io.o(.text+0x0):io.c: first defined here
kernel.o(.text+0x1d):kernel.c: multiple definition of `_in'
io.o(.text+0x1d):io.c: first defined here
I dont know why... I tried to put the "#ifndef.." stuff in the IO file..but it does not work.. when my kernel grows bigger I can have it all in just one file :)

Re:multiple definition

Posted: Mon Jun 28, 2004 9:09 am
by Curufir
Sorry, might be reading that wrong.

You included the io.c in kernel.c then tried to link io.c and kernel.c together?

Re:multiple definition

Posted: Mon Jun 28, 2004 9:30 am
by Link
Whoops.. you?re right :) sorry..
anyways.. I?d like to only include a header with the prototypes..like this
io.h:
extern void in/out..
io.c:
void in ( .. ) {.. }..

in main:
include "io.h"
but I cant get that working