Page 1 of 1

linking to string error

Posted: Thu Jun 11, 2009 4:52 am
by amjad88
hi to all i am new to os dev but not to c++ i am having a problem in the kernel when i use #include<string> i get


kernel.o(.text+0x51):kernel.cpp: undefined reference to `__ZNSsC1Ev'
kernel.o(.text+0xe1):kernel.cpp: undefined reference to `__ZNSsD1Ev'


can any one help plz thx

Re: linking to string error

Posted: Thu Jun 11, 2009 4:58 am
by JamesM
You can't include <string> as you don't have a standard library.

Re: linking to string error

Posted: Thu Jun 11, 2009 5:09 am
by amjad88
ok what can i do to fix this error

Re: linking to string error

Posted: Thu Jun 11, 2009 5:11 am
by JamesM
amjad88 wrote:ok what can i do to fix this error
Don't #include <string> !

You can't use any standard library function in a kernel.

You could also use capital letters and punctuation, and lose the text-speak. That could help too.

Re: linking to string error

Posted: Thu Jun 11, 2009 5:12 am
by amjad88
soo what is the soution how to use string ??

Re: linking to string error

Posted: Thu Jun 11, 2009 5:13 am
by JamesM
JamesM wrote: You can't use any standard library function in a kernel.
You can't use string. Full stop. You have to write your own string handling functions.

Re: linking to string error

Posted: Thu Jun 11, 2009 5:14 am
by amjad88
can i plz have your email thx

Re: linking to string error

Posted: Thu Jun 11, 2009 5:16 am
by JamesM
No, and as a special favour I'm going to lock this thread and give you an official warning.

thx

EDIT: I have now permbanned him for abusing me via PM.