The problem is that the program you're trying to build is missing the definition for Math::addNumbers
. This is probably due to the fact that you are only trying to build your main source file.
You need to make it so that the code defining Math::addNumbers
ends up being linked into your program. To do that, you have two main options (let's assume that your files are called main.cpp and math.cpp):
You can modify your build system to also compile the math.cpp. This is generally regarded as the correct way to handle this situation. Unfortunately, the specifics depend on your build system or IDE...
For instance, if you're using gcc, you could link both files into your binary using the following build command:gcc -o myprogram main.cpp math.cpp
You can simply
#include "math.cpp"
inside of main.cpp. This will lead to the code of math.cpp actually being part of main.cpp after preprocessing. This is generally not the recommended way of doing this, but is less environment-specific than the "proper" solution