Page 1 of 1

'undefined reference to __gxx_personality_v0' error

Posted: Tue Jun 10, 2008 8:20 am
by huxuelei
Hi, I have read the article "The Screen" at http://www.jamesmolloy.co.uk/tutorial_h ... creen.html

When I use the code in the article, put them in ".c" file, eveything is fine.
Then I put these codes in ".cpp" file, encapsulate these functions into class.
I use the Makefile like this:

Code: Select all

SOURCES=boot.o main.o terminal.o

LD=ld
CXXFLAGS=-nostdlib -nostdinc++ -Wall
LDFLAGS=-Tlink.ld
ASFLAGS=-felf

all: $(SOURCES) link

clean:
	-rm *.o kernel

link:
	$(LD) $(LDFLAGS) -o kernel $(SOURCES)

.s.o:
	nasm $(ASFLAGS) $<

.cpp.o:
	$(CXX) -c $(CXXFLAGS) $< -o $@
After I make these files, I got the following infomation:
nasm -felf boot.s
g++ -c -nostdlib -nostdinc++ -Wall main.cpp -o main.o
g++ -c -nostdlib -nostdinc++ -Wall terminal.cpp -o terminal.o
ld -Tlink.ld -o kernel boot.o main.o terminal.o
main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
make: *** [link] Error 1

Here is my source file list:
io.h
main.cpp
terminal.cpp
terminal.h
boot.s

(I think, these source file can be compiled successfully, maybe I do not need to paste the code of these file. :D )

Can anyone tell me how to solve this problem?Thanks.

Posted: Tue Jun 10, 2008 8:22 am
by JamesM
See the wiki on making a kernel in C++.

You need to add the -fno-exceptions and -fno-rtti flags.

Posted: Wed Jun 11, 2008 3:49 am
by huxuelei
Thank you.