Filling TTree but setting Event ID manually?

Concerning the compilation error: it seems you are missing the correct flags for the linker, see Trying to compile C++ and link to ROOT libraries?

There will be four consecutive entries in the tree with the same event id, I believe.

What you probably want is double-entry index:
tree.BuildIndex("EventNr","TDCid");

This way, you can do this kind of loop:
for(i=0;i<maxEvents;++i) for (j=0;j<nTDCS;++j) tree.GetEntryWithIndex(i,j);

See ROOT: TTreeIndex Class Reference

An alternative would be to have each TDC in a different TTree.