Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 编译错误c++&引用;未在此范围内声明&引用;预期的类型说明符";等_C++_Compiler Errors_G++ - Fatal编程技术网

C++ 编译错误c++&引用;未在此范围内声明&引用;预期的类型说明符";等

C++ 编译错误c++&引用;未在此范围内声明&引用;预期的类型说明符";等,c++,compiler-errors,g++,C++,Compiler Errors,G++,下面是我看到的错误列表 RST.hpp:23:18: error: ‘RSTNode’ has not been declared RST.hpp:23:38: error: ‘RSTNode’ has not been declared RST.hpp:23:45: error: expected ‘,’ or ‘...’ before ‘<’ token RST.hpp:41:30: error: ‘RSTNode’ has not been declared RST.hpp:41:3

下面是我看到的错误列表

RST.hpp:23:18: error: ‘RSTNode’ has not been declared
RST.hpp:23:38: error: ‘RSTNode’ has not been declared
RST.hpp:23:45: error: expected ‘,’ or ‘...’ before ‘<’ token
RST.hpp:41:30: error: ‘RSTNode’ has not been declared
RST.hpp:41:37: error: expected ‘,’ or ‘...’ before ‘<’ token
RST.hpp:44:28: error: ‘RSTNode’ has not been declared
RST.hpp:44:35: error: expected ‘,’ or ‘...’ before ‘<’ token
RST.hpp: In member function ‘virtual void RST<Data>::leftRotate(int)’:
RST.hpp:25:7: error: ‘RSTNode’ was not declared in this scope
RST.hpp:25:19: error: expected primary-expression before ‘>’ token
RST.hpp:25:23: error: ‘dummyone’ was not declared in this scope
RST.hpp:25:34: error: ‘ptr’ was not declared in this scope
RST.hpp:26:19: error: expected primary-expression before ‘>’ token
RST.hpp:26:23: error: ‘dummytwo’ was not declared in this scope
RST.hpp:27:19: error: expected primary-expression before ‘>’ token
RST.hpp:27:23: error: ‘dummythree’ was not declared in this scope
RST.hpp: In member function ‘virtual bool RST<Data>::addToTree(int)’:
RST.hpp:46:11: error: ‘ptr’ was not declared in this scope
RST.hpp:48:13: error: ‘num’ was not declared in this scope
RST.hpp:50:11: error: ‘temp’ was not declared in this scope
RST.hpp:55:11: error: ‘temp’ was not declared in this scope
RST.hpp:63:20: error: expected type-specifier before ‘RSTNode’
RST.hpp:63:20: error: expected ‘;’ before ‘RSTNode’
RST.hpp:64:23: error: ‘temp’ was not declared in this scope
RST.hpp: In member function ‘bool RST<Data>::insert(const Data&) [with Data = countint]’:
test_RST.cpp:43:23:   instantiated from here
RST.hpp:14:7: error: no matching function for call to             RST<countint>::addToTree(BSTNode<countint>*&, NULL, const countint&)’
RST.hpp:14:7: note: candidate is:
RST.hpp:44:18: note: bool RST<Data>::addToTree(int) [with Data = countint]
RST.hpp:44:18: note:   candidate expects 1 argument, 3 provided
RST.hpp:23:18:错误:“RSTNode”尚未声明
RST.hpp:23:38:错误:“RSTNode”尚未声明
RST.hpp:23:45:错误:在“”标记之前应为“”或“…”
RST.hpp:27:23:错误:未在此作用域中声明“DumMyTree”
RST.hpp:在成员函数“虚拟布尔RST::addToTree(int)”中:
RST.hpp:46:11:错误:“ptr”未在此范围内声明
RST.hpp:48:13:错误:“num”未在此作用域中声明
RST.hpp:50:11:错误:未在此作用域中声明“temp”
RST.hpp:55:11:错误:未在此作用域中声明“temp”
RST.hpp:63:20:错误:“RSTNode”之前应为类型说明符
RST.hpp:63:20:错误:应为“;”在'RSTNode'之前
RST.hpp:64:23:错误:未在此作用域中声明“temp”
RST.hpp:在成员函数“bool RST::insert(const Data&)[with Data=countint]”中:
test_RST.cpp:43:23:从此处实例化
hpp:14:7:错误:没有用于调用RST::addToTree(BSTNode*&,NULL,const countint&)的匹配函数
RST.hpp:14:7:注:候选人为:
hpp:44:18:note:boolrst::addToTree(int)[带Data=countint]
RST.hpp:44:18:注:候选人期望1个参数,提供3个参数
这是我所有的代码,除了测试仪,它在这一点上很好

请帮忙,我不知道为什么会这样

注意:BST是RST的超类//BSTNode是RSTNode的超类


谢谢

问题似乎是您没有在“RST.hpp”中包含“RSTNode.hpp”。因此,“rstnodenotdeclared”错误消息完全正确


这个错误不是我在你上一个问题中猜到的,所以你最好撤销这个更改。

谢谢你,我没有注意到这一点真是太傻了……呸,但现在我还有一大堆其他错误……恐怕我要放弃这门课了。模板代码引入了一组全新的错误可能性。