作者ric2k1 (Ric)
看板EE_DSnP
標題Re: [問題] 請問在ltest.h以外哪裡會呼叫到ADT呢?
時間Thu Dec 21 23:48:48 2006
※ 引述《pg30123 (CKu.none | PG)》之銘言:
: 標題: [問題] 請問在ltest.h以外哪裡會呼叫到ADT呢?
: 時間: Wed Dec 20 23:37:07 2006
:
: 剛才下載了最新的code在工作站解開以後
:
: 將寫好的array.h丟上去 並make a成功得到./ltest.array執行檔
:
: 但是嘗試執行ladd 時發生記憶體區段錯誤(-f -b皆是)
:
: 但我在ltest.cpp的CmdExecStatu sLAddCmd::exec(const string& option)中
:
: 84行處 return CMD_EXEC_DONE; 前加上一行cout << "LADD command DONE" < endl;
:
: 執行的結果有顯示出該行才發生記憶體錯誤
:
: 跟ADT有關的動作應該都在ltest.addFront(rep)或ltest.addBack(rep)中執行了
:
: 不該會因我code的錯誤而在其他地方造成error
:
: 不知是我有沒想清楚的地方呢@@ 還是另外的code有呼叫到我們寫的ADT呢
:
: --
: ※ 發信站: 批踢踢實業坊(ptt.cc)
: ◆ From: 220.135.4.76
: 推 timrau:我也這樣,而且用自己寫的testbench都沒事 12/20 23:38
: → timrau:trace發現似乎是死在vector<string> options的descructor.. 12/20 23:38
: → timrau:而且不只array會死,slist和dlist也都一樣.... 12/20 23:39
: 推 ric2k1:有辦法讓我看看你們的 code 嗎? 12/21 11:04
I have tried pg30123, timrau, and my version on a Linux 2.6.11-1.1369_FC4smp
machine. Yes, it will crash @
0x0092a9b7 in __gnu_cxx::__pool<true>::_M_reclaim_block ()
from /usr/lib/libstdc++.so.6
After tracing it a little bit, it seems to be a problem in libstdc++.
I then googled "__pool<true>::_M_reclaim_bloc". It seems that other people
have the similar issue. And some people think that it is due to some version
of g++ is not happy with some version of libstdc++...
Anyway, a quick work around is that I have made a libcmd.a for g++ 4.0
compiler. So if you encounter the above problem ---
(1) Please down load "libcmd.a.4.0" from <classweb>/Homework/libcmd.a.4.0
(2) Then copy it to hw5/lib
(3) Rename the old libcmd.a to libcmd.a.3.4.2
(4) ln -s libcmd.a.4.0 libcmd.a
Then try to make again.
Please let me know if this solve you problem...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.91.222.144
→ ric2k1:link also available at Homework website 12/21 23:53
推 timrau:看來解決了,謝謝老師 12/22 00:16
推 ric2k1:Good. But I think we use the same machine. I am 12/22 00:25
→ ric2k1:wondering it it works for other people? 12/22 00:26
推 kahang:我好像失敗了>"<不知道是我寫的code問題還是其他原因囧 12/22 01:21
→ kahang:我是用ccws工作站 12/22 01:23
推 ric2k1:真奇怪...I have created libcmd.a.ccws2. Please try. 12/22 02:03
推 kahang:我用libcmd.a.ccws2成功了^^謝謝老師:) 12/22 11:08
推 pg30123:4.0失敗 ccws2成功 @_@ 12/22 13:13