G++ undefined reference to class::function

This is a linker error. Try:

g++ test.cpp Telephone.cpp -o test

Basically, the linker is complaining about functions you used but didn’t provide an implementation for. To see all the steps the compiler performs for you, throw in a -v:

g++ -v test.cpp Telephone.cpp -o test

Leave a Comment