Hello everybody, i'm new to OS development and I was reading some of the wiki tutorials and I managed to build a simple kernel in C, but I'm more used to OOP, so I want to build it in C++. But I got a problem when linking 2 object files compiled with g++, I'm doing like this:
ld -T linker.ld -o kernel.bin entry.o main.o system.o
entry.o is an object file compiled by nasm, main.o and system.o are object files compiled by g++. ld returns me this message: main.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
If I just link main.o and entry.o it links perfectly, I have no idea of what's happening.
Problem linking(ld) c++ files
Re: Problem linking(ld) c++ files
Simple solution: You seem to either use exceptions or have not turned off exception handling in your g++ settings.
I'd turn off rtti and exceptions for a kernel though, so just add -fno-rtti and -fno-exceptions to your build settings for c++ files.
.eh_frame is an exception handling frame generated by the compiler. It uses some compiler intrinsic, which is probably located in another library you need to link with.Phinos wrote:main.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
I'd turn off rtti and exceptions for a kernel though, so just add -fno-rtti and -fno-exceptions to your build settings for c++ files.