How NOT to compile a C++ program
You know you have been away from C++ programming (almost a year for me now) when you try to compile a C++ program like this:
varun@dumbledore:~/cpp$ gcc -ansi -pedantic hello_world.cpp
/tmp/ccNWmUfg.o(.text+0x1b): In function `main':
: undefined reference to `std::cout'
/tmp/ccNWmUfg.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/ccNWmUfg.o(.text+0x49): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccNWmUfg.o(.text+0x7a): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccNWmUfg.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
Yikes!! What I uttered when I realized my mistake simply cannot be published here :-)
3 comments