How to install a custom boost version in CentOS?

You have to add -Wl,-R/usr/local/lib to the LDFLAGS when compiling your program.

-R is a linker option (for specifying a runtime linker path) - -Wl instructs gcc to pass it to ld.

With shared libraries you have to make sure that they are found by the linker during compile and during runtime (cf. flags -L and -R).

You can use

$ ldd myProgramm

to verify if the runtime-linker path was set correctly, i.e. if it can find the needed shared libraries on program start/which shared libraries it will load.