_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
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥20 使用Photon PUN2解决游戏得分同步的问题
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了