The project has 2 classes - Tree and TreeTest class
The TreeTest class tests the functions of Tree class.
TreeTest.h
#ifndef TREETEST_H #define TREETEST_H class TreeTest { public: TreeTest(); virtual ~TreeTest(); void InitTreeFunctionTest(); protected: private: }; #endif // TREETEST_H
TreeTest.cpp
#include "TreeTest.h" #include "Tree.h" #include <cstring> #include <iostream> using namespace std; void TreeTest::InitTreeFunctionTest() { //code goes here }
Main.cpp
#include <iostream> #include <Tree.h> #include <TreeTest.h> using namespace std; int main(int argc, char* argv[]) { TreeTest* tt; tt->InitTreeFunctionTest(); }
But it gives the following error when I compile using
g++ -fprofile-arcs -ftest-coverage main.cpp -I<full path to library> -o test
undefined reference to `TreeTest::InitTreeFunctionTest()'
Can anyone please help me find the error?
Thanks