# gcc mai.cpp -o mai /tmp/ccbehLsK.o(.text+0x1b): In function `main': : undefined reference to `std::cout' /tmp/ccbehLsK.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/ccbehLsK.o(.text+0x49): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `std::ios_base::Init::Init()' /tmp/ccbehLsK.o(.text+0x7a): In function `__tcf_0': : undefined reference to `std::ios_base::Init::~Init()' /tmp/ccbehLsK.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status
а если так: # g++ mai.cpp -o mai #./mai Hello LOR!!!
# gcc mai.cpp -o mai
/tmp/ccbehLsK.o(.text+0x1b): In function `main': : undefined reference to `std::cout' /tmp/ccbehLsK.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/ccbehLsK.o(.text+0x49): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `std::ios_base::Init::Init()' /tmp/ccbehLsK.o(.text+0x7a): In function `__tcf_0': : undefined reference to `std::ios_base::Init::~Init()' /tmp/ccbehLsK.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status
а если так:
# g++ mai.cpp -o mai
#./mai
Hello LOR!!!
У меня gcc, g++, cc - все симлинки на один и тот же бинарник - видимо при запуске смотрится параметр $0, а уже в зависимости от него выбирается действие.