作者noblebell (高貴的鈴)
看板EE_DSnP
標題[問題] 莫名的undeclare scope
時間Wed Dec 2 22:33:58 2009
以下是我程式片段的bug:
../../include/dlist.h: In constructor 'DList<T>::DList()':
../../include/dlist.h:41: error: '_head' was not declared in this scope
../../include/dlist.h:41: error: '_tail' was not declared in this scope
../../include/dlist.h: In destructor 'DList<T>::~DList()':
../../include/dlist.h:44: error: there are no arguments to 'clear' that
depend on a template parameter, so a declaration of 'clear' must be available
../../include/dlist.h:44: error: (if you use '-fpermissive', G++ will accept
your code, but allowing the use of an undeclared name is deprecated)
.......
我之前有類似的情況是在static funx未在.cpp檔,instatiate的時候.....
但這次我真的搞不清楚了@@"
_head、_tail明明是Dlist class的private data member,為什麼它會看不到?同時,
adtTest.h也有出現以下complain:
adtTest.cpp:49: error: cannot define member function
'DList<T>::AdtResetCmd::exec' within 'DList<T>'
adtTest.cpp:63: error: cannot define member function
'DList<T>::AdtResetCmd::usage' within 'DList<T>'
......
(adtTest.cpp我都沒碰啊~~~)
我已經確定應該沒少{} (少了,它應該會紅紅的).....
請問像這樣的情形可能有的其他原因是什麼? (要我砍掉重練??!)
謝謝大家的回答~
--
我即使想憑著"浩然正氣"寫程式也不能....因為.....
我只有"一股傻氣".......囧
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.251.6
1F:推 ric2k1:建議 comment 掉一些 code 看看 compile error 的變化 12/02 22:46
2F:推 richard12228:我也有碰到耶 應該是括弧沒括好 12/03 02:03
3F:→ noblebell:謝謝教授和同學。我comment掉一些code出現新的error, 12/03 13:20
4F:→ noblebell:發現主要是少個"}" 12/03 13:21