我在用VC编译时出现以下错误:
--------------------Configuration: Huffman - Win32 Debug--------------------
Compiling...
Huffman.cpp
Linking...
Huffmantest.obj : error LNK2005: "char * string" (?string@@3PADA) already defined in Huffman.obj
Huffmantest.obj : error LNK2001: unresolved external symbol "void __cdecl HuffmanCodebuid(struct HTNode *,char * *,int)" (?HuffmanCodebuid@@YAXPAUHTNode@@PAPADH@Z)
Huffmantest.obj : error LNK2001: unresolved external symbol "char * * HC" (?HC@@3PAPADA)
Huffmantest.obj : error LNK2001: unresolved external symbol "struct HTNode * HT" (?HT@@3PAUHTNode@@A)
Debug/Huffman.exe : fatal error LNK1120: 3 unresolved externals
执行 link.exe 时出错.
Huffman.exe - 1 error(s), 0 warning(s)
源程序的其他相关部分内容如下:
typedef struct
{
int weight;
int parent,lchild,rchild;
}HTNode, *HuffmanTree;
typedef char * * HuffmanCode;
HC = (HuffmanCode) malloc((n+1)*sizeof(char*));//存编码的头指针
cd = (char*)malloc(n*sizeof(char));//分配求编码的工作空间
HT = (HuffmanTree) malloc((m+1)*sizeof(HTNode));
请大家办我看一下,谢谢了