You should put most independent library in the end of the command, so compiler can find symbol and definitions properly:
c++ -L/usr/lib/x86_64-linux-gnu -o tom tom.o Block.o IPC.o \
ConnectMxctl.o CI_Metadata.o Log.o \
-lmysqlclient -lpthread -lz -lm -lrt -ldl
By doing it this way, compiler will continue searching undefined symbols from next linking files. For exampile if IPO.o
has uses symbol(type/class/struct/function etc) defined in CI_Metadata.o
, compiler can find it because you put CI_Metadata.o
after IPO.o
. Most libraries are independent, that's why they are in the end of compile/link command.