Napisałem sobie ostatnio prosty programik w c++, próbowałem go skompilować za pomocą gcc i napotkał mnie bardzo dziwny komunikat. Sam kod jest w 100% poprawny, więc pytanie brzmi czy to chwilowy błąd gcc (SID) czy brakuje czegoś kompilatorowi. Stawiam raczej na to drugie jednak nie mam pojęcia czego może brakować. Ten sam komunikat pojawia się nawet podczas próby kompilacji programiku typu Hello World
Oto co pokazuje gcc:
Kod: Zaznacz cały
tomson@debian:~/Desktop/c++$ gcc droga.cpp
/tmp/cckdndZJ.o: In function `main':
droga.cpp :( .text+0xf): undefined reference to `std::cout'
droga.cpp :( .text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: :o perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
droga.cpp :( .text+0x1c): 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> >&)'
droga.cpp :( .text+0x21): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
droga.cpp :( .text+0x2b): undefined reference to `std::cout'
droga.cpp :( .text+0x30): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: :o perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
droga.cpp :( .text+0x3a): undefined reference to `std::cin'
droga.cpp :( .text+0x3f): undefined reference to `std::basic_istream<char, std::char_traits<char> >: :o perator>>(unsigned int&)'
droga.cpp :( .text+0x44): 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> >&)'
droga.cpp :( .text+0x49): undefined reference to `std::cout'
droga.cpp :( .text+0x4e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
droga.cpp :( .text+0x5b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: :o perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
droga.cpp :( .text+0x65): undefined reference to `std::cin'
droga.cpp :( .text+0x6a): undefined reference to `std::basic_istream<char, std::char_traits<char> >: :o perator>>(unsigned int&)'
droga.cpp :( .text+0x6f): 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> >&)'
droga.cpp :( .text+0x74): undefined reference to `std::cout'
droga.cpp :( .text+0x79): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
droga.cpp :( .text+0x89): undefined reference to `std::cout'
droga.cpp :( .text+0x8e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: :o perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
droga.cpp :( .text+0x98): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(unsigned int)'
droga.cpp :( .text+0xa0): 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> >&)'
droga.cpp :( .text+0xa5): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
droga.cpp :( .text+0xb5): undefined reference to `std::cout'
droga.cpp :( .text+0xba): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: :o perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
droga.cpp :( .text+0xc4): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(unsigned int)'
droga.cpp :( .text+0xcc): 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> >&)'
droga.cpp :( .text+0xd1): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
droga.cpp :( .text+0xec): undefined reference to `std::cout'
droga.cpp :( .text+0xf1): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: :o perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
droga.cpp :( .text+0xfb): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(unsigned int)'
droga.cpp :( .text+0x103): 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> >&)'
droga.cpp :( .text+0x108): undefined reference to `std::basic_ostream<char, std::char_traits<char> >: :o perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/cckdndZJ.o: In function `__static_initialization_and_destruction_0(int, int)':
droga.cpp :( .text+0x13b): undefined reference to `std::ios_base::Init::Init()'
droga.cpp :( .text+0x140): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cckdndZJ.o :( .eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status