i get these error
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x1b): undefined reference to BST<char>::BST()'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x1eb): undefined reference to
BST::insert(char const&)'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x228): undefined reference to BST<char>::traversePreorder(BSTNode<char>*)'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x263): undefined reference to
BST::search(char const&) const'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x32b): undefined reference to BST<char>::deleteNode(char const&)'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x419): undefined reference to
BST::leafCount(BSTNode*)'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x47c): undefined reference to BST<char>::search(char const&) const'
C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x4d5): undefined reference to
BST::getSiblings(char const&)'
collect2.exe: error: ld returned 1 exit status
but i have no idea why.... my guess is linking but i have check the headers and i still cant see it
my driver.cpp(main)
#include <iostream>
#include <iomanip>
#include "BST.h"
using namespace std;
int main()
{
BST<char> op1;
int action = 0;
int numInsert = 0;
char value;
cout<<"-------------------- MENU ----------------------"
<<endl<<"1. Insert node(s)"
<<endl<<"2. Traverse Preorder"
<<endl<<"3. Search BST"
<<endl<<"4. Delete node"
<<endl<<"5. Leaf Count"
<<endl<<"6. Sibling of a node"
<<endl<<"7. Quit"
<<endl<<"Please ent
switch (action)
{
case 1:
cout << "\n How many values would you liek to insert to a BST? ";
cin>>numInsert;
for(int i =0; i<numInsert;i++){
cout<<"What value would you like to insert to the list: ";
cin >> value;
op1.insert(value); //check
}
break;
...
}
--- BST.h ---
#include <iostream>
#include "BSTNode.h"
using namespace std;
#ifndef BINARY
#define BINARY
template <typename DataType>
class BST
{
public:
BST();
// ~BST();
bool empty() const;
/*------------------------------------------------------------------------
Check if BST is empty.
Precondition: None.
Postcondition: Returns true if BST is empty and false otherwise.
-----------------------------------------------------------------------*/
void insert(const DataType & item);
void traversePreorder(BSTNode<DataType> * startPoint);
bool search(const DataType & item)const;
bool deleteNode(const DataType & item);
int leafCount(BSTNode<DataType> * startPoint);
DataType getSiblings(const DataType & item);
private:
BSTNode<DataType> * treeRoot;
typedef BSTNode<DataType> * BSTNodePointer;
void search2(const DataType & item, bool & found, BSTNodePointer & locptr, BSTNodePointer & parent) const;
};
please help