I am getting errors saying linker error undefined reference to (function name)
what does this mean? How can I correct it?
I am getting errors saying linker error undefined reference to (function name)
what does this mean? How can I correct it?
it means you didn't write out what that function did, or you didn't link in the correct library.
It means one of these (typically)
- you need to write the function.
- you need to check the spelling - C++ is case sensitive, so 'foo' is different from 'Foo'.
- you need to check the parameters - declaring foo(int a) and defining foo(double a) are different functions.
- you forgot to specify the name of a library.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
It could also mean that you forgot to include in the project the file that has the function definition.
Or if the function is a member function of a class, perhaps you forgot the ClassName:: in the definition.