[Solved] Why am I getting an undefined reference error while using separate .cpp and .h files for a class?
In your second and final step, you didn’t instruct the compiler (linker more exactly) to take into account Adder.o, so your final executable still doesn’t know the implementation of Adder::add Try, after getting Adder.o, to run g++ main.cpp Adder.o Also, this may be relevant : Difference between compiling with object and source files Also, if … Read more