EE_DSnP 板


LINE

============解答已出炉============ 因为dlist.h最後少加一大括号 导致整个definition 错位 在adtTest.cpp就会有定义错误的问题... =========解答完毕之我蠢了========= compiling 是件刺激的事情 尤其是你不知道bug会从四面八方何处猛然冒出捅人 怎麽死的都不知道... - 刚刚雀跃地想试试看compile 结果就出现一长串的错误: compiling: adtTest.cpp In file included from adtTest.cpp:10:0: adtTest.h:75:65: warning: friend declaration ‘std::ostream& operator<<(std::ostream&, const DList<T>::AdtTestObj&)’ declares a non-template function adtTest.h:75:65: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) adtTest.h:120:4: error: need ‘typename’ before ‘ DList<DList<T>::AdtTestObj>::iterator’ because ‘DList<DList<T>::AdtTestObj> ’ is a dependent scope adtTest.h:154:52: error: ‘DList<DList::AdtTestObj>::iterator’ is not a type adtTest.cpp:16:27: error: type ‘DList<T>::AdtTestObj’ is not derived from type ‘DList<T>’ adtTest.cpp:35:24: error: cannot define member function ‘ DList<T>::AdtTestObj::AdtTestObj’ within ‘DList<T>’ adtTest.cpp:42:55: error: ‘std::ostream& DList<T>::operator<<(std::ostream&, const DList<T>::AdtTestObj&)’ must take exactly one argument adtTest.cpp:51:39: error: cannot define member function ‘ DList<T>::AdtResetCmd::exec’ within ‘DList<T>’ adtTest.cpp:65:33: error: cannot define member function ‘ DList<T>::AdtResetCmd::usage’ within ‘DList<T>’ adtTest.cpp:71:21: error: cannot define member function ‘ DList<T>::AdtResetCmd::help’ within ‘DList<T>’ adtTest.cpp:81:37: error: cannot define member function ‘ DList<T>::AdtAddCmd::exec’ within ‘DList<T>’ adtTest.cpp:110:31: error: cannot define member function ‘ DList<T>::AdtAddCmd::usage’ within ‘DList<T>’ adtTest.cpp:116:19: error: cannot define member function ‘ DList<T>::AdtAddCmd::help’ within ‘DList<T>’ adtTest.cpp:127:40: error: cannot define member function ‘ DList<T>::AdtDeleteCmd::exec’ within ‘DList<T>’ adtTest.cpp:175:34: error: cannot define member function ‘ DList<T>::AdtDeleteCmd::usage’ within ‘DList<T>’ adtTest.cpp:182:22: error: cannot define member function ‘ DList<T>::AdtDeleteCmd::help’ within ‘DList<T>’ adtTest.cpp:192:39: error: cannot define member function ‘ DList<T>::AdtPrintCmd::exec’ within ‘DList<T>’ adtTest.cpp:218:33: error: cannot define member function ‘ DList<T>::AdtPrintCmd::usage’ within ‘DList<T>’ adtTest.cpp:224:21: error: cannot define member function ‘ DList<T>::AdtPrintCmd::help’ within ‘DList<T>’ adtTest.cpp:227:1: error: expected ‘}’ at end of input In file included from adtTest.cpp:10:0: adtTest.h: In member function ‘void DList<T>::AdtTest::deleteRandom(size_t)’ : adtTest.h:100:41: error: there are no arguments to ‘getPos’ that depend on a template parameter, so a declaration of ‘getPos’ must be available adtTest.h:100:41: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) adtTest.h: In member function ‘void DList<T>::AdtTest::printForward()’: adtTest.h:135:7: error: need ‘typename’ before ‘ DList<DList<T>::AdtTestObj>::iterator’ because ‘DList<DList<T>::AdtTestObj> ’ is a dependent scope adtTest.h:135:37: error: expected ‘;’ before ‘li’ adtTest.h:136:14: error: ‘li’ was not declared in this scope adtTest.h: In member function ‘void DList<T>::AdtTest::printBackward()’: adtTest.h:143:7: error: need ‘typename’ before ‘ DList<DList<T>::AdtTestObj>::iterator’ because ‘DList<DList<T>::AdtTestObj> ’ is a dependent scope adtTest.h:143:37: error: expected ‘;’ before ‘li’ adtTest.h:143:62: error: ‘li’ was not declared in this scope adtTest.h: In member function ‘void DList<T>::AdtTest::printData(size_t, int, size_t)’: adtTest.h:156:36: error: invalid type argument of unary ‘*’ adtTest.cpp: At global scope: adtTest.cpp:30:1: error: expected unqualified-id at end of input - 虽然很挫志, 但是面临bug不de怎能说修过DSnP(?) 但就在此时我赫然发现... ... adtTest.cpp我压根儿没动过啊... ... 哪呢!? 据说作业的所有问题都可以靠make clean->make 32解决 没变 据说我有可能在参考implementation时动到 重新解压缩! 没变... 连error message都给我难兄难弟般的一模一样 Q _ Q 这... 难道我在某个地方做了蠢事!? --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.4.191
1F:→ shryuhuai:'DList<DList::AdtTestObj>::iterator’ is not a type 11/26 15:41
2F:→ shryuhuai:我猜是定义iterator的scope漏了}或; 11/26 15:44
3F:→ simpdanny:检查了...不是,这样如此应该是compile dlist.h错误吧? 11/26 16:01
4F:→ djshen:所以还没找到错喔@@ 11/26 16:04
5F:→ simpdanny:对啊... 11/26 16:04
6F:→ djshen:看起来的确像是哪里忘了加}.. 11/26 16:08
7F:→ shryuhuai:会不会是iteerator的scope结尾没有加; 11/26 16:12
8F:→ simpdanny:djshen(大钧神)是对的!=..=谢谢>"< 11/26 16:34
※ 编辑: simpdanny 来自: 140.112.4.191 (11/26 16:37)
9F:→ simpdanny:谢谢你们帮忙Q^Q 11/26 16:38
10F:→ djshen:.. 11/26 16:53







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:WOW站内搜寻

TOP