I keep getting the error: "Redefinition of 'CBSTree'" and "Previous definition is here" on all my functions in my cbstree.cpp code. I'm not sure why. I believe I have the correct include guards and such. Help would be very much appreciated! Thank you.
main.cpp
#include <iostream>
#include <cstdlib>
using namespace std;
#include "cbstree.h"
// define to show duplicate insertions
#define SHOW_INSERT
// defined constants
const int BUFLEN = 256;
cbstree.cpp
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
#include "cbstree.h"
template <typename NodeType>
CBSTree<NodeType>::CBSTree(const CBSTree<NodeType> &other)
{
m_root = NULL;
if(m_root != other.m_root)
{
DestroyTree();
m_root = CopyTree(other.m_root);
}
} // end of "CBSTree<NodeType>::CBSTree"
cbstree.h
#ifndef CBIN_SEARCH_TREE_HEADER
#define CBIN_SEARCH_TREE_HEADER
#include "ctreenode.h"
// class declaration
template <typename NodeType>
class CBSTree
{
public:
// constructors and destructor
CBSTree() : m_root(NULL) {}
CBSTree(const CBSTree &other);
virtual ~CBSTree() { DestroyTree(); }
...
#include "cbstree.cpp"
#endif // CBIN_SEARCH_TREE_HEADER
ctreenode.h
#ifndef CTREE_NODE_HEADER
#define CTREE_NODE_HEADER
#include <iostream>
using namespace std;
template <typename NodeValueType>
class CTreeNode
...
#endif // CTREE_NODE_HEADER