Skip to content

經典報錯

undefined reference to `WinMain@16'|

main 打錯字了,程式找不到main()

記憶體區段錯誤! Segmentation fault

記憶體錯誤
1. 陣列設定太大
2. 陣列搜尋時超出陣列範圍

函數沒有 return 0;

也有可能是max不夠大

函數沒return

系統呼叫了 abort 函式! terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_allocAborted (core dumped)

耗盡系統記憶體

terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

耗盡系統記憶體並引發 std::bad_alloc 異常

沒有定義st的排序順序

no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream}' and '__gnu_cxx::__normal_iterator >')|

沒有定義st的排序順序,也就是沒有寫:

bool operator< (const st& other) const {
    return x < other.x;
}