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:

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


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

           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 */
                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];
        return tempKey;

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

Ignore this!

This article has been dead for over six months. Start a new discussion instead.