I was just bouncing around and found this thread from so long ago...
I must have missed that people needed help. Sorry!
You need to add `pkg-config --libs lcm` to your g++ command to properly link lcm files
Be it in command line or makefile
for instance:
g++ main.cpp `pkg-config --libs lcm` -o test_exe
Hope this helps someone down the line.