Q:

LNK error 1561 with BOOST

I am trying to create an avl tree then using boost to check if what I created is working. However, in all my boost test cases I don't have a main(which I thought is the issue causing the problem). This is my avl .hpp
I'm somewhat new to c++.
template <typename T>
class avlTreeNode
{
public:
    // data in the node
    T nodeValue;
    // pointers to the left and right children of the node
    avlTreeNode<T> *left;
    avlTreeNode<T> *right;
    int balanceFactor;
    // CONSTRUCTOR
    avlTreeNode (const T& item, avlTreeNode<T> *lptr = NULL,
        avlTreeNode<T> *rptr = NULL, int bal = 0):
    nodeValue(item), left(lptr), right(rptr), balanceFactor(bal)
    {
    }
};

const int leftheavy = -1;
const int balanced = 0;
const int rightheavy = 1;

template <typename T>
class avlTree
{
public:
    // CONSTRUCTORS, DESTRUCTOR, ASSIGNMENT
    // constructor. initialize root to NULL and size to 0
    avlTree();
    ~avlTree();

    typedef T* iterator;
    typedef T const* const_iterator;
    // constructor. insert n elements from range of T* pointers4
    avlTree(T *first, T *last);
    // search for item. if found, return an iterator pointing
    // at it in the tree; otherwise, return end()
    iterator find(const T& item);
    // search for item. if found, return an iterator pointing
    // at it in the tree; otherwise, return end()
    const_iterator find(const T& item) const;
    // indicate whether the tree is empty
    int empty() const;
    // return the number of data items in the tree
    int size() const;
    // give a vertical display of the tree .
    void displayTree(int maxCharacters) const;
    // insert item into the tree
    //std::pair<iterator, bool> insert(const T& item);
    // insert a new node using the basic List operation and format
    //std::pair<iterator, bool> insert(const T& item);
    // delete all the nodes in the tree
    void clear();
    // constant versions
    iterator begin();
    iterator end();
    const_iterator begin() const;
    const_iterator end() const;

///////////////////////////////////////////////////////////
//when I created this it started giving me the lnk 1561 error 
    std::pair<iterator,bool> insert(const T& item)
    {
        avlTree<T>::iterator iter;
        // quietly return if item is already in the tree
        if ((iter = find(item)) != end() )
            return std::pair<iterator,bool>(iter,false);
        // declare AVL tree node pointers.
        avlTreeNode<T> *treeNode = root,*newNode;
        // flag used by AVLInsert to rebalance nodes
        bool reviseBalanceFactor = false;
        // get a new AVL tree node with empty pointer fields
        newNode = getavlTreeNode(item,NULL,NULL);
        // call recursive routine to actually insert the element
        avlInsert(treeNode, newNode, reviseBalanceFactor);
        // assign new values to data members root, size and current
        root = treeNode;
        treeSize++;
        return std::pair<iterator, bool> (iterator(newNode), true);
    }

private:
    // pointer to tree root
    avlTreeNode<T> *root;
    // number of elements in the tree
    int treeSize;
    // allocate a new tree node and return a pointer to it
    avlTreeNode<T> *getavlTreeNode(const T& item,
        avlTreeNode<T> *lptr,avlTreeNode<T> *rptr);
    // used by copy constructor and assignment operator
    avlTreeNode<T> *copyTree(avlTreeNode<T> *t);
    // delete the storage occupied by a tree node
    void freeavlTreeNode(avlTreeNode<T> *p);
    // used by destructor, assignment operator and clear()
    void deleteTree(avlTreeNode<T> *t);
    // locate a node item and its parent in tree. used by find()
    avlTreeNode<T> *findNode(const T& item, 
        avlTreeNode<T>* & parent) const;
    // member functions to insert and erase a node
    void singleRotateLeft (avlTreeNode<T>* &p);
    void singleRotateRight (avlTreeNode<T>* &p);
    void doubleRotateLeft (avlTreeNode<T>* &p);
    void doubleRotateRight (avlTreeNode<T>* &p);
    void updateLeftTree (avlTreeNode<T>* &tree,
        bool &reviseBalanceFactor);
    void updateRightTree (avlTreeNode<T>* &tree,
        bool &reviseBalanceFactor);
};

A:

On the top of your cpp file, define BOOST_TEST_MAIN. It is used to automatically generate main function by the unit testing library.
For example:
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include "avl.hpp"

BOOST_AUTO_TEST_CASE( test )
{
    // ...
}

