Programming Tips - How can I fix these errors from gcc:

Date: 2014oct25 Language: C/C++ Product: gcc Q. How can I fix these errors from gcc:
/tmp/ccovXmih.o: In function `main': example.cpp:(.text+0x15): undefined reference to `std::cout' example.cpp:(.text+0x1a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /tmp/ccovXmih.o: In function `__static_initialization_and_destruction_0(int, int)': example.cpp:(.text+0x48): undefined reference to `std::ios_base::Init::Init()' example.cpp:(.text+0x57): undefined reference to `std::ios_base::Init::~Init()' collect2: error: ld returned 1 exit status
A. This is a link-time error. Its not finding the iostream library. Use the -lstdc++ option like this:
gcc -lstdc++ example.cpp