I am creating a text compression using huffman algorithm . In this I want to create a Huffman Tree , CreateHMNode accept two nodes and create a node with sum of frequency of others .
but it shows this error ,please help me to solve
LNK2019 unresolved external symbol "public: __cdecl HMnode::HMnode(void)" (??0HMnode@@QEAA@XZ) referenced in function "public: void __cdecl HMtree::build_tree(class HMnode *,class HMnode *)" (?build_tree@HMtree@@QEAAXPEAVHMnode@@0@Z)
void build_tree(HMnode* temp3, HMnode* temp13)
{
HMnode* head1;
HMnode* newnode = new HMnode;
newnode = createHMNode(temp3, temp13);
head1 = newnode;
HMnode* mytemp = calldeque();
createHMNode(newnode, mytemp);
}
The
HMnode::HMnode(void)mentioned in the error message is theHMnodedefault constructor.When you do
new HMnodeyou default-construct aHMnodeobject, and it needs the default constructor.If, for some reason, you don't have a default constructor you will get an error about it. Normally you would get a compiler (not link) error, which means there's a declaration of the
HMnodedefault constructor, but there's no definition (implementation).Either you don't link with all object files or libraries, or you forgot to define (implement) the default constructor in your code.