lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
980 stars 388 forks source link

Undefine reference to ....... #320

Closed Joechencc closed 4 years ago

Joechencc commented 4 years ago

I checked #200, but my issue is slightly different. I follow the guide to have sender/listener.cpp example. The sender works pretty well. I am using my own LCM message. It ends up with the following errors.

The operation system is : ubutu 16.04 LTS and gcc version is (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

image

wxmerkt commented 4 years ago

You are compiling a C++ file with gcc - have you tried adding -lstdc++ (or g++)?

Joechencc commented 4 years ago

I did not notice it , it solves. I suggest the comment in the listener changes. Currently it is

// file: listener.cpp // // LCM example program. // // compile with: // $ gcc -o listener listener.cpp -llcm // // On a system with pkg-config, you can also use: // $ gcc -o listener listener.cpp pkg-config --cflags --libs lcm