The codes comprises 1 header file and 1 source file. I have cut the irrelevent codes and still maintain the compilation error.
Huffman.h
#ifndef HUFFMAN
#define HUFFMAN
template<int size>
class Huffman{
protected:
int code_len[size];
int code[size];
void genCode(){
}
};
template<int size>
class HuffmanEncode :public Huffman<size>{
public:
void f(){
for (int i = 0; i < size; i++){
code_len[i] = 0;
}
}
};
#endif
main.cpp
#include"Huffman.h"
int main()
{
HuffmanEncode<256> h;
}
The member variable code_len
is defined in the base class. I don't know why it said code_len
is undefined.