C++ problem

hi everyone !

plz help me out on this simple program i m trying to run. actually its my first compilation on my newly installed kde 4.1 and i havent explored linux much !

editor :- KWrite

program :-

using std::cout;
using std::endl;

int main()
	cout<<"Hello, world!"<<endl;

when i compile it , i get this errors :-

jayant@linux-ana9:~/Documents> gcc -o hello_world hello_world.cpp
/tmp/cc9zBrFd.o: In function `main':
hello_world.cpp:(.text+0x1c): undefined reference to `std::cout'
hello_world.cpp:(.text+0x21): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;& std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&, char const*)'
hello_world.cpp:(.text+0x29): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
hello_world.cpp:(.text+0x31): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;& (*)(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&))'
/tmp/cc9zBrFd.o: In function `__static_initialization_and_destruction_0(int, int)':
hello_world.cpp:(.text+0x60): undefined reference to `std::ios_base::Init::Init()'
hello_world.cpp:(.text+0x65): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc9zBrFd.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

well…i m not sure abt the compiling command i m giving but i m pretty much sure abt the program that its right !:stuck_out_tongue:

so plz tell the mistake guys !

thankyou !:slight_smile:

Call the compiler as g++ or c++, otherwise it thinks you are compiling a C program.

oops :shame: thx mate !

solved !~!