第一次在Sentos的GCC下编译出现有关问题怎么处理

第一次在Sentos的GCC上编译出现问题怎么办?/tmp/ccCCoaqH.o: In function `main:gc_test.cpp:(.text+0x27

第一次在Sentos的GCC上编译出现问题怎么办?
/tmp/ccCCoaqH.o: In function `main':
gc_test.cpp:(.text+0x27): undefined reference to `operator new(unsigned int)'
gc_test.cpp:(.text+0x4e): undefined reference to `__cxa_get_exception_ptr'
gc_test.cpp:(.text+0x66): undefined reference to `__cxa_begin_catch'
gc_test.cpp:(.text+0x75): undefined reference to `std::cout'
gc_test.cpp:(.text+0x7a): 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*)'
gc_test.cpp:(.text+0x8b): undefined reference to `std::bad_alloc::~bad_alloc()'
gc_test.cpp:(.text+0x90): undefined reference to `__cxa_end_catch'
gc_test.cpp:(.text+0xa7): undefined reference to `std::bad_alloc::~bad_alloc()'
gc_test.cpp:(.text+0xb0): undefined reference to `__cxa_end_catch'
gc_test.cpp:(.text+0xe6): undefined reference to `std::cout'
gc_test.cpp:(.text+0xeb): 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*)'
gc_test.cpp:(.text+0xf7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
gc_test.cpp:(.text+0xff): 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> >&)'
gc_test.cpp:(.text+0x107): 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> >&))'
gc_test.cpp:(.text+0x128): undefined reference to `std::cout'
gc_test.cpp:(.text+0x12d): 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 c
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x1d2): 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*)'
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x1da): 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> >&)'
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x1e1): undefined reference to `std::cout'
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x1e6): 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> >&))'
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x23b): 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> >&)'
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x242): undefined reference to `std::cout'
gc_test.cpp:(.text._ZN5GCPtrIiLi0EE8showlistEv[GCPtr<int, 0>::showlist()]+0x247): 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/ccCCoaqH.o: In function `std::list<GCInfo<int>, std::allocator<GCInfo<int> > >::_M_create_node(GCInfo<int> const&)':
gc_test.cpp:(.text._ZNSt4listI6GCInfoIiESaIS1_EE14_M_create_nodeERKS1_[std::list<GCInfo<int>, std::allocator<GCInfo<int> > >::_M_create_node(GCInfo<int> const&)]+0x63): undefined reference to `__cxa_begin_catch'
gc_test.cpp:(.text._ZNSt4listI6GCInfoIiESaIS1_EE14_M_create_nodeERKS1_[std::list<GCInfo<int>, std::allocator<GCInfo<int> > >::_M_create_node(GCInfo<int> const&)]+0x7a): undefined reference to `__cxa_rethrow'
gc_test.cpp:(.text._ZNSt4listI6GCInfoIiESaIS1_EE14_M_create_nodeERKS1_[std::list<GCInfo<int>, std::allocator<GCInfo<int> > >::_M_create_node(GCInfo<int> const&)]+0x83): undefined reference to `__cxa_end_catch'
/tmp/ccCCoaqH.o: In function `std::list<GCInfo<int>, std::allocator<GCInfo<int> > >::_M_erase(std::_List_iterator<GCInfo<int> >)':
gc_test.cpp:(.text._ZNSt4listI6GCInfoIiESaIS1_EE8_M_eraseESt14_List_iteratorIS1_E[std::list<GCInfo<int>, std::allocator<GCInfo<int> > >::_M_erase(std::_List_iterator<GCInfo<int> >)]+0xe): undefined reference to `std::_List_node_base::unhook()'
/tmp/ccCCoaqH.o: In function `__gnu_cxx::new_allocator<std::_List_node<GCInfo<int> > >::deallocate(std::_List_node<GCInfo<int> >*, unsigned int)':
gc_test.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt10_List_nodeI6GCInfoIiEEE10deallocateEPS4_j[__gnu_cxx::new_allocator<std::_List_node<GCInfo<int> > >::deallocate(std::_List_node<GCInfo<int> >*, unsigned int)]+0xd): undefined reference to `operator delete(void*)'
/tmp/ccCCoaqH.o: In function `__gnu_cxx::new_allocator<std::_List_node<GCInfo<int> > >::allocate(unsigned int, void const*)':
gc_test.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt10_List_nodeI6GCInfoIiEEE8allocateEjPKv[__gnu_cxx::new_allocator<std::_List_node<GCInfo<int> > >::allocate(unsigned int, void const*)]+0x24): undefined reference to `std::__throw_bad_alloc()'
gc_test.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt10_List_nodeI6GCInfoIiEEE8allocateEjPKv[__gnu_cxx::new_allocator<std::_List_node<GCInfo<int> > >::allocate(unsigned int, void const*)]+0x38): undefined reference to `operator new(unsigned int)'
/tmp/ccCCoaqH.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
/tmp/ccCCoaqH.o:(.eh_frame+0xaf): undefined reference to `__gxx_personality_v0'
collect2: ld 返回 1


这是一个传说很简单的垃圾回收程序编译时的错误信息,初学C++更是不知到在GCC 上怎么编译这些程序。求高手指教。。。

[解决办法]
楼主,你拿gcc编译的.cpp文件?这个不行吧
你装上g++ 就好了吧,如果程序没问题的话