_tianyu1994_ 2015-11-21 14:59 采纳率: 0%
浏览 5043

c++模版不可识别的模板声明/定义

#include
using namespace std;

template
struct Binary_node
{
public:
Binary_node();
Binary_node(const Entry & x);

private:
Entry data;
Binary_node *left;
Binary_node *right;

};

template
class Binary_tree
{
public:
Binary_tree();
~Binary_tree();
void Layer_order(Binary_node & x);
Binary_node* getRoot();

protected:
Binary_node *root;

};

template
Binary_tree::Binary_tree()
{
}

template
Binary_tree::~Binary_tree()
{
}

template
void Binary_tree::Layer_order(Binary_node & x )
{

}

template
Binary_node* Binary_Tree::getRoot()
{
return root;
}

int main(void)
{
Binary_tree binarytree;
binarytree.Layer_order(*(binarytree.getRoot()));

return 0;

}

错误 2 error C2988: 不可识别的模板声明/定义 e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 6 error C2447: “{”: 缺少函数标题(是否是老式的形式表?) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 60 1 TEST_empty
错误 1 error C2143: 语法错误 : 缺少“;”(在“<”的前面) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 5 error C2143: 语法错误 : 缺少“;”(在“{”的前面) e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 60 1 TEST_empty
错误 3 error C2059: 语法错误:“<” e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty
错误 4 error C2039: “getRoot”: 不是“`global namespace'”的成员 e:\exercise of programming\datastructrue+cpp\test_empty\test_empty\test.cpp 53 1 TEST_empty

  • 写回答

3条回答 默认 最新

  • devmiao 2015-11-21 15:37
    关注

    模板没有识别,你的定义是不是有问题

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记