[silos@asakura test]$ gcc main.cpp
/tmp/cc0bXYoP.o: In function `__static_initialization_and_destruction_0(int, int)':main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/cc0bXYoP.o: In function `__tcf_0':main.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc0bXYoP.o: In function `main':main.cpp:(.text+0x8e): undefined reference to `std::cout'
:main.cpp:(.text+0x93): 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/cc0bXYoP.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[silos@asakura test]$ gcc -x c++ -o test main.cpp
/tmp/ccKq7mGP.o: In function `__static_initialization_and_destruction_0(int, int)':main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccKq7mGP.o: In function `__tcf_0':main.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccKq7mGP.o: In function `main':main.cpp:(.text+0x8e): undefined reference to `std::cout'
:main.cpp:(.text+0x93): 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/ccKq7mGP.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[silos@asakura test]$ gcc --version
gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[silos@asakura test]$ uname -a
Linux asakura.org 2.6.16-1.2096_FC5 #1 Wed Apr 19 05:14:36 EDT 2006 i686 athlon i386 GNU/Linux
[silos@asakura test]$ echo 'main() {}' > main2.cpp
[silos@asakura test]$ gcc -o test2 main2.cpp
[silos@asakura test]$ vim main.cpp
[silos@asakura test]$ gcc -o test main.cpp
In file included from /usr/lib/gcc/i386-redhat-linux/4.1.0/../../../../include/c++/4.1.0/backward/iostream.h:31,
from main.cpp:1:
/usr/lib/gcc/i386-redhat-linux/4.1.0/../../../../include/c++/4.1.0/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X> header for C++ includes, or <iostream> instead of the deprecated header <iostream>. To disable this warning use -Wno-deprecated.
/tmp/ccuMP04V.o: In function `__static_initialization_and_destruction_0(int, int)':main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccuMP04V.o: In function `__tcf_0':main.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccuMP04V.o: In function `main':main.cpp:(.text+0x8e): undefined reference to `std::cout'
:main.cpp:(.text+0x93): 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/ccuMP04V.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[silos@asakura test]$