C++ Common compile/linker errors (GCC) undefined reference to `***'


Example

This linker error happens, if the linker can't find a used symbol. Most of the time, this happens if a used library is not linked against.

qmake:

LIBS += nameOfLib

cmake:

TARGET_LINK_LIBRARIES(target nameOfLib)

g++ call:

g++ -o main main.cpp -Llibrary/dir -lnameOfLib

One might also forget to compile and link all used .cpp files (functionsModule.cpp defines the needed function):

g++  -o binName main.o functionsModule.o