multiple definition

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Link

multiple definition

Post 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 :)
Curufir

Re:multiple definition

Post 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?
Link

Re:multiple definition

Post 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
Post Reply