hotbeard
11-18-2004, 04:31 AM
Okay, hopefully this is an easy fix. I have three c++ files I am trying to build in MS Visual C++ .NET
BinaryHeap.h
BinaryHeap.cpp
Huffman.cpp
Huffman.cpp conatins my main() function.
It also has an #include "BinaryHeap.h"
BinaryHeap.cpp also has an #include "Binaryheap.h"
my BinaryHeap.h file has two things i need to make global. They are listed below:
struct HuffmanNode
{
string data ;
int frequency ;
HuffmanNode *left ;
HuffmanNode *right ;
};
HuffmanNode *forest[27] ;
I am getting the linking errors listed below:
binaryheap.obj : error LNK2005: "struct HuffmanNode * * forest" (?forest@@3PAPAUHuffmanNode@@A) already defined in Huffman.obj
Debug/Homework6.exe : fatal error LNK1169: one or more multiply defined symbols found
I believe the compiler is complaining that the struct is defined twice becuase of the way I have my #include's arranged. I have tried to fix this but cannot. I have no clue how to tweak the compiler settings to fix this. Can someone clue me in on how to fix this and how best to use #include statements. Thanks
Aaron
BinaryHeap.h
BinaryHeap.cpp
Huffman.cpp
Huffman.cpp conatins my main() function.
It also has an #include "BinaryHeap.h"
BinaryHeap.cpp also has an #include "Binaryheap.h"
my BinaryHeap.h file has two things i need to make global. They are listed below:
struct HuffmanNode
{
string data ;
int frequency ;
HuffmanNode *left ;
HuffmanNode *right ;
};
HuffmanNode *forest[27] ;
I am getting the linking errors listed below:
binaryheap.obj : error LNK2005: "struct HuffmanNode * * forest" (?forest@@3PAPAUHuffmanNode@@A) already defined in Huffman.obj
Debug/Homework6.exe : fatal error LNK1169: one or more multiply defined symbols found
I believe the compiler is complaining that the struct is defined twice becuase of the way I have my #include's arranged. I have tried to fix this but cannot. I have no clue how to tweak the compiler settings to fix this. Can someone clue me in on how to fix this and how best to use #include statements. Thanks
Aaron