我正在尝试声明矢量地图,但它给出了错误。
我的代码:
int main() {
map <int, vector<int> > ele;
return 0;
}
错误 :
In function `__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, std::vector<int, std::allocator<int> > > > >::deallocate(std::_Rb_tree_node<std::pair<int const, std::vector<int, std::allocator<int> > > >*, unsigned int)':
q2.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKiSt6vectorIiSaIiEEEEE10deallocateEPS8_j[__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, std::vector<int, std::allocator<int> > > > >::deallocate(std::_Rb_tree_node<std::pair<int const, std::vector<int, std::allocator<int> > > >*, unsigned int)]+0xd): undefined reference to `operator delete(void*)'
/tmp/ccjbk0JX.o: In function `__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned int)':
q2.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE10deallocateEPij[__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned int)]+0xd): undefined reference to `operator delete(void*)'
/tmp/ccjbk0JX.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
/tmp/ccjbk0JX.o:(.eh_frame+0xa7): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
我无法理解这个错误。请帮忙。