作者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
1F:→ ric2k1:link also available at Homework website 12/21 23:53
2F:推 timrau:看来解决了,谢谢老师 12/22 00:16
3F:推 ric2k1:Good. But I think we use the same machine. I am 12/22 00:25
4F:→ ric2k1:wondering it it works for other people? 12/22 00:26
5F:推 kahang:我好像失败了>"<不知道是我写的code问题还是其他原因囧 12/22 01:21
6F:→ kahang:我是用ccws工作站 12/22 01:23
7F:推 ric2k1:真奇怪...I have created libcmd.a.ccws2. Please try. 12/22 02:03
8F:推 kahang:我用libcmd.a.ccws2成功了^^谢谢老师:) 12/22 11:08
9F:推 pg30123:4.0失败 ccws2成功 @_@ 12/22 13:13