'undefined reference to __gxx_personality_v0' error

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
huxuelei
Member
Member
Posts: 35
Joined: Tue May 27, 2008 8:32 am

'undefined reference to __gxx_personality_v0' error

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

See the wiki on making a kernel in C++.

You need to add the -fno-exceptions and -fno-rtti flags.
huxuelei
Member
Member
Posts: 35
Joined: Tue May 27, 2008 8:32 am

Post by huxuelei »

Thank you.
Post Reply