0

I am trying to build a binary tree in c++ when I compile I get an error that says:

Undefined                       first referenced
 symbol                             in file
Btree::destroy_tree(node*)          /var/tmp//cc1bssfK.o
Btree::remove(int, node*)           /var/tmp//cc1bssfK.o
Btree::insert(int, node*)           /var/tmp//cc1bssfK.o
Btree::search(int, node*)           /var/tmp//cc1bssfK.o
Btree::~Btree()                     /var/tmp//cc1bssfK.o
Btree::Btree()                      /var/tmp//cc1bssfK.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Any suggestions would be great thanks!

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mike_2000_17
0

Its a linking error, you must have forgot one source file in the compilation. The error means that the function definitions are not found by the linker. Those should normally be in the source file that correspond to the header in which these functions are declared, but you need to compile that source file along with your other source files in order for the linker to be able to find those function definitions.

If you have more trouble with solving this, just describe the split of functions between headers and sources, and how you are compiling them, and we can help.

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.