Cannot link to custom library

Hello,

I am using a custom library, which uses several ROOT libraries, which I then link to when compiling programs. This all works perfectly on several other machines with the same makefile. I am trying to reproduce the environment here.

The makefile works and seems to find all of the libraries and compile the custom one properly. However, when including #Header.h files and linking to this library,

tbranch: tbranch.cc libNPDG.so g++ -O3 `root-config --cflags --glibs` -l TreePlayer $^ -L, -o tbranch

I get a long list of error messages like:

libNPDG.so is the custom library. These errors only happen when linking to this library and including such headers as #TF1.h. As I said, this is well-tested on several other machines, so I know the library works with ROOT.

My g++ is 4.6.3, and ROOT is 5.34.

echo $ROOTSYS /usr/local/include/root

I have tried ordering the library flags to follow their dependencies, but this does not change the error messages. How can I get the library to link?