How can I get this code to work?
main.cpp
#include <iostream>
#include "TestClass.h"
using namespace std;
int main()
{
TestClass testclass;
int number = testclass.AddNumbers(3, 5);
cout << number << endl;
return 0;
}
TestClass.h
#ifndef TESTCLASS_H
#define TESTCLASS_H
class TestClass
{
public:
TestClass();
int AddNumbers(int num1, int num2);
protected:
private:
};
#endif // TESTCLASS_H
TestClass.cpp
#include "TestClass.h"
TestClass::TestClass(){
}
int TestClass::AddNumbers(int num1, int num2){
return num1 + num2;
}
The only error I get is "Undefined reference to TestClass::TestClass() and "Undefined reference to TestClass::AddNumbers(int, int)".