Linux C++: Linker is outputting strange errors
- by knight666
Alright, here is the output I get:
arm-none-linux-gnueabi-ld --entry=main -dynamic-linker=/system/bin/linker -rpath-link=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -L/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -nostdlib -lstdc++ -lm -lGLESv1_CM -rpath=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -rpath=../../YoghurtGum/lib/Android -L./lib/Android intermediate/Alien.o intermediate/Bullet.o intermediate/Game.o intermediate/Player.o ../../YoghurtGum/bin/YoghurtGum.a -o bin/Galaxians.android
intermediate/Game.o: In function `Galaxians::Init()':
/media/YoghurtGum/Tests/Galaxians/src/Game.cpp:45: undefined reference to `__cxa_end_cleanup'
/media/YoghurtGum/Tests/Galaxians/src/Game.cpp:44: undefined reference to `__cxa_end_cleanup'
intermediate/Game.o:(.ARM.extab+0x18): undefined reference to `__gxx_personality_v0'
intermediate/Game.o: In function `Player::Update()':
/media/YoghurtGum/Tests/Galaxians/src/Player.h:41: undefined reference to `__cxa_end_cleanup'
intermediate/Game.o:(.ARM.extab.text._ZN6Player6UpdateEv[_ZN6Player6UpdateEv]+0x0): undefined reference to `__gxx_personality_v0'
intermediate/Game.o:(.rodata._ZTIN10YoghurtGum4GameE[_ZTIN10YoghurtGum4GameE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
intermediate/Game.o:(.rodata._ZTI6Player[_ZTI6Player]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
intermediate/Game.o:(.rodata._ZTIN10YoghurtGum6EntityE[_ZTIN10YoghurtGum6EntityE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
intermediate/Game.o:(.rodata._ZTIN10YoghurtGum6ObjectE[_ZTIN10YoghurtGum6ObjectE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
intermediate/Game.o:(.rodata._ZTI6Bullet[_ZTI6Bullet]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
intermediate/Game.o:(.rodata._ZTI5Alien[_ZTI5Alien]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
intermediate/Game.o:(.rodata+0x20): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
../../YoghurtGum/bin/YoghurtGum.a(Sprite.o):(.rodata._ZTIN10YoghurtGum16SpriteDataOpenGLE[_ZTIN10YoghurtGum16SpriteDataOpenGLE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
../../YoghurtGum/bin/YoghurtGum.a(Sprite.o):(.rodata._ZTIN10YoghurtGum10SpriteDataE[_ZTIN10YoghurtGum10SpriteDataE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
make: *** [bin/Galaxians.android] Fout 1
Here's an error I managed to decipher:
intermediate/Game.o: In function `Galaxians::Init()':
/media/YoghurtGum/Tests/Galaxians/src/Game.cpp:45: undefined reference to `__cxa_end_cleanup'
/media/YoghurtGum/Tests/Galaxians/src/Game.cpp:44: undefined reference to `__cxa_end_cleanup'
This is line 43 through 45:
Assets::AddSprite(new Sprite("media\\ViperMarkII.bmp"), "ship");
Assets::AddSprite(new Sprite("media\\alien.bmp"), "alien");
Assets::AddSprite(new Sprite("media\\bat_ball.bmp"), "bullet");
So, what seems funny to me is that the first new is fine (line 43), but the second one isn't. What could cause this?
intermediate/Game.o: In function `Player::Update()':
/media/YoghurtGum/Tests/Galaxians/src/Player.h:41: undefined reference to `__cxa_end_cleanup'
Another issue with new:
Engine::game->scene_current->AddObject(new Bullet(m_X + 10, m_Y));
I have no idea where to begin with the other issues.
These are my makefiles, They're a giant mess because I'm just trying to get it to work.
Static library:
# ====================================== #
# #
# YoghurtGum static library #
# #
# ====================================== #
include ../YoghurtGum.mk
PROGS = bin/YoghurtGum.a
SOURCES = $(wildcard src/*.cpp)
#$(YG_PATH_LIB)/libGLESv1_CM.so \
#$(YG_PATH_LIB)/libEGL.so \
YG_LINK_OPTIONS = -shared
YG_LIBRARIES = \
$(YG_PATH_LIB)/libc.a \
$(YG_PATH_LIB)/libc.so \
$(YG_PATH_LIB)/libstdc++.a \
$(YG_PATH_LIB)/libstdc++.so \
$(YG_PATH_LIB)/libm.a \
$(YG_PATH_LIB)/libm.so \
$(YG_PATH_LIB)/libui.so \
$(YG_PATH_LIB)/liblog.so \
$(YG_PATH_LIB)/libGLESv2.so \
$(YG_PATH_LIB)/libcutils.so \
YG_OBJECTS = $(patsubst src/%.cpp, $(YG_INT)/%.o, $(SOURCES))
YG_NDK_PATH_LIB = /home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib
all: $(PROGS)
rebuild: clean $(PROGS)
# remove all .o objects from intermediate and all .android objects from bin
clean:
rm -f $(YG_INT)/*.o $(YG_BIN)/*.a
copy:
acpy ../$(PROGS)
$(PROGS): $(YG_OBJECTS)
$(YG_ARCHIVER) -vq $(PROGS) $(YG_NDK_PATH_LIB)/crtbegin_static.o $(YG_NDK_PATH_LIB)/crtend_android.o $^ && \
$(YG_ARCHIVER) -vr $(PROGS) $(YG_LIBRARIES)
$(YG_OBJECTS): $(YG_INT)/%.o : $(YG_SRC)/%.cpp
$(YG_COMPILER) $(YG_FLAGS) -I $(GLES_INCLUDES) -c $< -o $@
Test game project:
# ====================================== #
# #
# Galaxians #
# #
# ====================================== #
include ../../YoghurtGum.mk
PROGS = bin/Galaxians.android
YG_COMPILER = arm-none-linux-gnueabi-g++
YG_LINKER = arm-none-linux-gnueabi-ld
YG_PATH_LIB = ./lib/Android
YG_LIBRARIES = ../../YoghurtGum/bin/YoghurtGum.a
YG_PROGS = bin/Galaxians.android
GLES_INCLUDES = ../../YoghurtGum/src
ANDROID_NDK_ROOT = /home/oem/android-ndk-r3
NDK_PLATFORM_VER = 5
YG_NDK_PATH_LIB = $(ANDROID_NDK_ROOT)/build/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/lib
YG_LIBS = -nostdlib -lstdc++ -lm -lGLESv1_CM
#YG_COMPILE_OPTIONS = -g -rdynamic -Wall -Werror -O2 -w
YG_COMPILE_OPTIONS = -g -Wall -Werror -O2 -w
YG_LINK_OPTIONS = --entry=main -dynamic-linker=/system/bin/linker -rpath-link=$(YG_NDK_PATH_LIB) -L$(YG_NDK_PATH_LIB) $(YG_LIBS)
SOURCES = $(wildcard src/*.cpp)
YG_OBJECTS = $(patsubst src/%.cpp, intermediate/%.o, $(SOURCES))
all: $(PROGS)
rebuild: clean $(PROGS)
clean:
rm -f intermediate/*.o bin/*.android
$(PROGS): $(YG_OBJECTS)
$(YG_LINKER) $(YG_LINK_OPTIONS) -rpath=$(YG_NDK_PATH_LIB) -rpath=../../YoghurtGum/lib/Android -L$(YG_PATH_LIB) $^ $(YG_LIBRARIES) -o $@
$(YG_OBJECTS): intermediate/%.o : src/%.cpp
$(YG_COMPILER) $(YG_COMPILE_OPTIONS) -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -c $< -o $@
Any help would be appreciated.