Need help with ld
Posted: Fri Dec 21, 2007 2:10 pm
After I switched to Xubuntu Linux I am getting this error when linking with ld.
There not to much, but all I'm trying to do is compile and link.
I'm kind of new to Linux.
These are my makefiles.start.o:start.o:(.text+0x1): undefined reference to `__main'
start.o:start.o:(.text+0xb): undefined reference to `__atexit'
main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x129): undefined reference to `__dso_handle'
main.cpp:(.text+0x13d): undefined reference to `__cxa_atexit'
support.o: In function `_main':
support.c:(.text+0x9): undefined reference to `_CTOR_LIST__'
support.o: In function `_atexit':
support.c:(.text+0x3b): undefined reference to `_DTOR_LIST__'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/auszero/Programming/ChihuahuaOS/v0.01/Source'
make: *** [all] Error 2
Code: Select all
BUILDDIR = Build
all:
make -C Source
Code: Select all
ROOT=../
BUILDDIR=${ROOT}/Build
all:
gcc -c support.c -ffreestanding -nostdlib -fno-builtin -fno-exceptions
g++ -c print.cpp -nostdlib -fno-builtin -fno-rtti -fno-exceptions
g++ -c main.cpp -nostdlib -fno-builtin -fno-rtti -fno-exceptions
nasm -f aout start.asm -o start.o
nasm -f aout int.asm -o int.o
ld -T ${ROOT}/link.ld -o ${BUILDDIR}/KERNEL.BIN start.o int.o main.o print.o support.o
I'm kind of new to Linux.