透明水晶 2021-09-17 09:14 采纳率: 96.8%
浏览 79
已结题

问题:C++编译报错(2021/09/17)


PS E:\fly-prj\cplusplus\day15> make 
cc -o test test.cpp -g -Wall
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:/cygdrive/e/fly-prj/cplusplus/day15/test.cpp:17: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `main':
/cygdrive/e/fly-prj/cplusplus/day15/test.cpp:17: 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*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/e/fly-prj/cplusplus/day15/test.cpp:17: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/e/fly-prj/cplusplus/day15/test.cpp:17: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string const, std::string>::~pair()':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:211: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:211: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string const, std::string>::pair<char const (&) [6], char const (&) [33], true>(char const (&) [6], char const (&) [33])':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt4pairIKSsSsEC1IRA6_KcRA33_S3_Lb1EEEOT_OT0_+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string const, std::string>::pair<char const (&) [7], char const (&) [31], true>(char const (&) [7], char const (&) [31])':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt4pairIKSsSsEC1IRA7_KcRA31_S3_Lb1EEEOT_OT0_+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string const, std::string>::pair<char const (&) [5], char const (&) [29], true>(char const (&) [5], char const (&) [29])':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:353: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt4pairIKSsSsEC1IRA5_KcRA29_S3_Lb1EEEOT_OT0_+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string, std::string>::~pair()':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:211: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:211: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata+0x14): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(char const*, std::allocator<char> const&)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.h:3662: undefined reference to `std::string::_Alloc_hider::_Alloc_hider(char*, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEEC1ESt16initializer_listIS4_ERKS1_RKS5_+0x10): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EED1Ev+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator++()':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string, std::string>::pair<std::string const, std::string, true>(std::pair<std::string const, std::string> const&)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:301: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:301: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:301: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt4pairISsSsEC1IKSsSsLb1EEERKS_IT_T0_E+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EEC1ERKS6_RKS7_+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:600: undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:600: undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:601: undefined reference to `std::string::_S_empty_rep()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:601: undefined reference to `std::string::_Rep::_M_refdata()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:605: undefined reference to `std::__throw_logic_error(char const*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:610: undefined reference to `std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:612: undefined reference to `std::string::_Rep::_M_refdata()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:612: undefined reference to `std::string::_S_copy_chars(char*, char const*, char 
const*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:618: undefined reference to `std::string::_Rep::_M_set_length_and_sharable(unsigned long)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.tcc:619: undefined reference to `std::string::_Rep::_M_refdata()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::_Rb_tree_iterator<std::pair<std::string const, std::string> > std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_M_insert_<std::pair<std::string const, std::string> const&, std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::string const, std::string> const&, std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_Alloc_node&)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:1784: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'        
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE11_M_put_nodeEPSt13_Rb_tree_nodeIS2_E+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator--()':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:302: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `bool std::operator< <char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/basic_string.h:6342: undefined reference to `std::string::compare(std::string const&) const'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZStltIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_ES8_+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, std::string> > >::deallocate(std::_Rb_tree_node<std::pair<std::string const, std::string> >*, unsigned long)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:145: undefined reference to `operator delete(void*, unsigned long)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `void std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_M_construct_node<std::pair<std::string const, std::string> const&>(std::_Rb_tree_node<std::pair<std::string const, std::string> >*, std::pair<std::string const, std::string> const&)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:599: undefined reference to `__cxa_begin_catch'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:603: undefined reference to `__cxa_rethrow'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:599: undefined reference to `__cxa_end_catch'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE17_M_construct_nodeIJRKS2_EEEvPSt13_Rb_tree_nodeIS2_EDpOT_+0x10): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, std::string> > >::allocate(unsigned long, void const*)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:116: undefined reference to `std::__throw_bad_array_new_length()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:117: undefined reference to `std::__throw_bad_alloc()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o: in function `std::pair<std::string const, std::string>::pair(std::pair<std::string const, std::string> const&)':
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:314: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:314: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_pair.h:314: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZNSt4pairIKSsSsEC1ERKS1_+0xc): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.xdata$_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsSsEEE9constructIS4_JRKS4_EEEvPT_DpOT0_+0x10): undefined reference to `__gxx_personality_seh0'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.rdata$.refptr._ZNSt8ios_base4InitD1Ev[.refptr._ZNSt8ios_base4InitD1Ev]+0x0): undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.rdata$.refptr._ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_[.refptr._ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_]+0x0): 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> >&)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/lanfeiy/AppData/Local/Temp/ccDzBnxC.o:test.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to `std::cout'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/libcygwin.a(_cygwin_crt0_common.o):/usr/src/debug/cygwin-3.2.0-1/winsup/cygwin/lib/_cygwin_crt0_common.cc:78: undefined reference to `operator new(unsigned long)'
collect2: 错误:ld 返回 1
make: *** [Makefile:9:test] 错误 1
  • 写回答

2条回答 默认 最新

  • 透明水晶 2021-09-17 09:17
    关注

    将Makefile中的CC修改为CXX后OK

    PS E:\fly-prj\cplusplus\day15> make 
    g++ -o test test.cpp -g -Wall
    PS E:\fly-prj\cplusplus\day15> .\test.exe
    C++11 http://c.biancheng.net/cplus/11/
    Java http://c.biancheng.net/java/
    Python http://c.biancheng.net/python/
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月30日
  • 已采纳回答 9月22日
  • 创建了问题 9月17日

悬赏问题

  • ¥100 求购一套带接口实现实习自动签到打卡
  • ¥50 MacOS 使用虚拟机安装k8s
  • ¥500 亚马逊 COOKIE我如何才能实现 登录一个亚马逊账户 下发新 COOKIE ..我使用下发新COOKIE 导入ADS 指纹浏览器登录,我把账户密码 修改过后,原来下发新COOKIE 不会失效的方式
  • ¥20 玩游戏gpu和cpu利用率特别低,玩游戏卡顿
  • ¥25 oracle中的正则匹配
  • ¥15 关于#vscode#的问题:把软件卸载不会再出现蓝屏
  • ¥15 vimplus出现的错误
  • ¥15 usb无线网卡转typec口
  • ¥30 怎么使用AVL fire ESE软件自带的优化模式来优化设计Soot和NOx?
  • ¥15 Ubuntu20.04.4.LTS系统如何下载安装VirtualBox虚拟机?