[問題] 使用 map 導致 Segmentation fault
開發平台(Platform): (Ex: Win10, Linux, ...)
Linux (Windows Subsystem for Linux, Ubuntu 18.04)
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
編譯器:GCC 7.4.0
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
資料 insert 完後,需要用 find 找資料,但出現錯誤,且錯誤並非每次都出現
錯誤位置: 第31行,find function
餵入的資料(Input):
./main.cpp order.json info.txt
order.json: https://pastebin.com/FBTn9rRq
info.txt: https://pastebin.com/wAguCmjL
預期的正確結果(Expected Output):
2
0
0
1
錯誤結果(Wrong Output):
執行階段: Segmentation fault (core dumped)
gdb debug: 沒有錯誤
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
http://codepad.org/soCIfu0e
補充說明(Supplement):
這個錯誤很奇怪,有時候出現,有時候卻沒有,gdb也找不到錯誤
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.251.51.210 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1572777310.A.E39.html
推
11/03 18:54,
4年前
, 1F
11/03 18:54, 1F
我網路上看了很久,我還是不知道 core dump的位置在哪,我只動了 ulimit -c unlimited,還需要動什麼嗎
※ 編輯: mizuyoru3423 (111.251.51.210 臺灣), 11/03/2019 19:02:53
→
11/03 20:40,
4年前
, 2F
11/03 20:40, 2F
→
11/03 20:40,
4年前
, 3F
11/03 20:40, 3F
→
11/03 21:29,
4年前
, 4F
11/03 21:29, 4F
我當時也想用這個帳號註冊,原來就是你
推
11/04 01:07,
4年前
, 5F
11/04 01:07, 5F
※ 編輯: mizuyoru3423 (111.251.51.210 臺灣), 11/04/2019 09:19:38
→
11/04 10:23,
4年前
, 6F
11/04 10:23, 6F
推
11/04 18:30,
4年前
, 7F
11/04 18:30, 7F
→
11/04 18:31,
4年前
, 8F
11/04 18:31, 8F
→
11/04 18:32,
4年前
, 9F
11/04 18:32, 9F
→
11/04 18:33,
4年前
, 10F
11/04 18:33, 10F
→
11/04 18:34,
4年前
, 11F
11/04 18:34, 11F
→
11/04 18:36,
4年前
, 12F
11/04 18:36, 12F
→
11/04 18:37,
4年前
, 13F
11/04 18:37, 13F
www,其實實際原因也不是map,只是我的class就只有一個data menber而已
→
11/04 21:29,
4年前
, 14F
11/04 21:29, 14F
→
11/04 21:29,
4年前
, 15F
11/04 21:29, 15F
看起來蠻好玩的,改天試試
※ 編輯: mizuyoru3423 (111.251.51.210 臺灣), 11/04/2019 22:55:03
※ 編輯: mizuyoru3423 (111.251.51.210 臺灣), 11/04/2019 22:56:30
※ 編輯: mizuyoru3423 (111.251.51.210 臺灣), 11/04/2019 22:58:56
推
11/05 01:21,
4年前
, 16F
11/05 01:21, 16F