Hey guys,
Just got C++ How to Program 3rd Edition by Deitel & Deitel and I'm trying to compile the following using gcc:
Code:
// Fig. 1.2: fig01_02.cpp
// A first program in C++
#include <iostream>
int main()
{
std::cout << "Welcome to C++!\n";
return 0; // indicate that program ended successfully
}
However I get this error when trying to compile:
Code:
me@tux C++ $ gcc Fig01_02.cpp
/tmp/ccMzI0Dh.o(.text+0x1b): In function `main':
: undefined reference to `std::cout'
/tmp/ccMzI0Dh.o(.text+0x20): In function `main':
: 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/ccMzI0Dh.o(.text+0x49): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccMzI0Dh.o(.text+0x7a): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccMzI0Dh.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'collect2: ld returned 1 exit status