作者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