0

Hey all. Working on a Binary Tree of "N-order". For some reason I'm getting a fatal error while trying to compile my code. Let me know if you have any idea of what could be wrong, thanks.

I'm actually trying to model this off an implementation written in Java:
http://koders.com/java/fidAB3BF22D2F6F383D797E598C79B9DE16C02ECF9A.aspx?s=tree#L1

Error:
Undefined first referenced
symbol in file
main /opt/sfw/lib/gcc-lib/sparc-sun-solaris2.9/2.95.3/crt1.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Code:

class BTNode
{
        /* Making an N-Order B-Tree */

        public:
           int order;           // Order of the tree
           int nKey;            // Number of keys stored in node
           int kArray[];        // Array where keys are held.
           BTNode *btnArray;    // array of refs to node
           bool isLeaf;         // is the node a leaf
           BTNode* parent;      // link to root node

           /* Class Functions */
           BTNode()
           {
                parent = NULL;
           }
           BTNode( int, BTNode* );
           bool isEmpty() const {return parent==NULL; }
           int insert( int );
           int extractKey( int );
           int getKey( int );
           void getTreeNode( int );
};
BTNode::BTNode ( int treeOrder, BTNode* treeParent)
{
        order = treeOrder;
        parent = treeParent;
        kArray[2 * treeOrder - 1];
        btnArray = new BTNode[2 * treeOrder];
        isLeaf = true;
}
int BTNode::extractKey( int keyIndex )
{
        int tempKey = getKey(keyIndex);

        for (int i = keyIndex; i < nKey; i++)
        {
           kArray[i] = kArray[i + 1];
           if (!isLeaf)
           {
                btnArray[i] = btnArray[i + 1];
           }
        }
        nKey--;
        return tempKey;
}

int BTNode::getKey( int keyIndex )
{
        return kArray[keyIndex];
}

Ignore this!

Edited by Krysis: Made a FOOLISH mistake while programming.. Ignore post :-) Thanks.

2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by daviddoria
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.