1
我試圖聲明向量圖,但它給出了一個錯誤。聲明向量圖的錯誤
我的代碼:
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
我無法理解這樣的錯誤。 請幫忙。
你用什麼命令編譯?你也可以展示該程序的內容。 – pippin1289
此代碼沒有錯誤:http://ideone.com/vQgu7n使用g ++! – Sankalp