Page 1 of 1

Undefined reference to 'main'

Posted: Thu Jul 22, 2004 8:34 pm
by BiB
When i compile i have Undefined reference to 'main' in file crt0.o (function _exit)

What's wrong ??? I checked my c file and there is a main function

Posted: Thu Jul 22, 2004 9:50 pm
by blackdroid
apparently you are not giving gcc the source or object files needed for compiling properly, how do you invoke gcc ? ( you could paste your eventual Makefile ).

Posted: Thu Jul 22, 2004 11:40 pm
by BiB
Yesterday night i made it working but i unfortunately i deleted my directory :S

Here ismy makefile :

include $(PS2SDK)/Makefile.eeglobal

EE_NAME = ps2shell
EE_C = $(EE_NAME).c
EE_O = $(EE_NAME).o
EE_ELF = $(EE_NAME).elf

EE_INCS += -I$(PS2SDK)/ee/rpc/keyboard/include
EE_LIB += -L$(PS2SDK)/ee/rpc/keyboard/lib
EE_LIBS += -lkbd


all: $(EE_O)
ee-g++ $(EE_FLAGS) $(EE_INCS) $(EE_LIB) -o $(EE_ELF) $(EE_OBJS) $(EE_LIBS)

$(EE_O): $(EE_C)
ee-g++ $(EE_FLAGS) $(EE_INCS) $(EE_LIB) -c $(EE_C)


clean:
rm *.elf *.o

and here is the Makefile.eeglobal from ps2sdk ( i modified it)

EE_INCS = -I$(PS2DEV)/ee/ee/include -I$(PS2SDK)/ee/kernel/include -I$(PS2SDK)/ee/libc/include -I$(PS2SDK)/common/include -I$(PS2DEV)/ee/ee/include -Iinclude -I$(PS2SDK)/ee/debug/include
EE_LIB = -L$(PS2SDK)/ee/libc/lib -L$(PS2SDK)/ee/debug/lib -L$(PS2SDK)/ee/kernel/lib -L$(PS2DEV)/ee/ee/lib
EE_LIBS = -lc -lkernel -ldebug -lsyscall
EE_FLAGS = -nostartfiles -T$(PS2SDK)/ee/startup/linkfile -D_EE -O2 -G0 -Wall

EE_OBJS = $(PS2SDK)/ee/startup/obj/crt0.o $(PS2SDK)/ee/libc/obj/vsnprintf.o $(PS2SDK)/ee/libc/obj/sbrk.o $(PS2SDK)/ee/libc/obj/putchar.o $(PS2SDK)/ee/libc/obj/memcpy.o $(PS2SDK)/ee/libc/obj/strncpy.o

Posted: Fri Jul 23, 2004 12:57 am
by BiB
That's OK now

I remake my makefile including makefile_sample from sdk and it works

Thanks

Posted: Fri Jul 23, 2004 1:41 am
by blackdroid
goodie goodie tissue.