Código:
años.cpp:(.text+0x15): undefined reference to `std::cout'
años.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*)'
años.cpp:(.text+0x22): 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> >&)'
años.cpp:(.text+0x2a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
años.cpp:(.text+0x39): undefined reference to `std::cin'
años.cpp:(.text+0x3e): undefined reference to `std::basic_istream<char, std::char_traits<char> >::operator>>(int&)'
años.cpp:(.text+0x5a): undefined reference to `std::cout'
años.cpp:(.text+0x5f): 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*)'
años.cpp:(.text+0x6b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
años.cpp:(.text+0x7b): 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*)'
años.cpp:(.text+0x83): 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> >&)'
años.cpp:(.text+0x8b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccfMw7eG.o: In function `__static_initialization_and_destruction_0(int, int)':
años.cpp:(.text+0xb9): undefined reference to `std::ios_base::Init::Init()'
años.cpp:(.text+0xbe): undefined reference to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status
No sé por qué me da este error si el mismo archivo en Windows lo he compilado y probado perfectamente :S
El código en cuestión es este:
Código
#include <iostream> using namespace std; int main() { cout << "Anyo de Nacimiento? " << endl; int anyo; cin >> anyo; cout << "Tienes " << 2011 - anyo << "Anyos" << endl; }
Salu2