qq_34395778
2016-11-22 16:00明明无错却出现:不可识别的模板声明/定义
源码:(vs2015)
#include
using namespace std;
//节点类(抽象类)
template
class HuffNode
{
public:
HuffNode(){}
virtual ~HuffNode() {}
virtual int weight() = 0;
virtual bool isLeaf() = 0;
};
//叶节点类(继承自节点类)
template
class LeafNode :pulic HuffNode
{
private:
E it;
int wgt;
public:
//构造叶节点
LeafNode(const E& val, int freq)
{
it = val;
wgt = freq;
}
//返回该叶节点的权值
int weight()
{
return wgt;
}
//返回节点的值
E val()
{
return it;
}
//判断是否是叶节点
bool isLeaf()
{
return true;
}
};
错误报告:
1>------ 已启动生成: 项目: Huffman编码, 配置: Debug Win32 ------
1> main.cpp
1>c:\users\asus\desktop\huffman编码\huffman编码\huffman.h(14): error C2988: 不可识别的模板声明/定义
1>c:\users\asus\desktop\huffman编码\huffman编码\huffman.h(14): error C2143: 语法错误: 缺少“;”(在“<”的前面)
1>c:\users\asus\desktop\huffman编码\huffman编码\huffman.h(14): error C2059: 语法错误:“<”
1>c:\users\asus\desktop\huffman编码\huffman编码\huffman.h(15): error C2143: 语法错误: 缺少“;”(在“{”的前面)
1>c:\users\asus\desktop\huffman编码\huffman编码\huffman.h(15): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>c:\users\asus\desktop\huffman编码\huffman编码\huffman.h(25): error C2143: 语法错误: 缺少“,”(在“”的前面)
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- reactjs页面无法引入umi/link umi框架
- react.js
- 2个回答
- go:术语“ go”未被识别为cmdlet,函数,脚本文件或可运行程序的名称
- 互联网问答
- IT行业问题
- 编程语言问答
- it技术
- 计算机技术
- 2个回答
- 在PATH中执行bin,但是“执行版本”失败
- path
- bash
- 1个回答
- Golang模板:如何在变量中定义数组?
- variables
- templates
- arrays
- 3个回答
- PHP PDO_ODBC配置:错误:C编译器无法创建可执行文件
- c
- db2
- pdo
- php
- c++
- 1个回答