One of possible causes of this error is incorrect linking order of libraries using gcc/g++.
Linking libraries before object files causes the error:
g++ -o $(LIBS) $(PROGRAM) $(OBJS)
Linking libraries after object files solves the problem:
g++ -o $(PROGRAM) $(OBJS) $(LIBS)
This is a solution for static library linking. Shared libraries should link both ways. Also order of respective libraries is important. If library A uses library B, library B has to linked first (-lB -lA).