Undefined reference to 'main'

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
BiB
Posts: 36
Joined: Fri Feb 27, 2004 8:13 am
Location: France

Undefined reference to 'main'

Post 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
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post 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 ).
Kung VU
BiB
Posts: 36
Joined: Fri Feb 27, 2004 8:13 am
Location: France

Post 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
BiB
Posts: 36
Joined: Fri Feb 27, 2004 8:13 am
Location: France

Post by BiB »

That's OK now

I remake my makefile including makefile_sample from sdk and it works

Thanks
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

goodie goodie tissue.
Kung VU
Post Reply