C++, Ubuntu, codeblocks, GCC, LCM version 0.9.0: "undefined reference to lcm_create" in lcm-cpp-impl.hpp

1,207 views
Skip to first unread message

Chad Schaffer

unread,
Jun 13, 2012, 10:55:39 AM6/13/12
to Lightweight Communications and Marshalling
it's also complaining about "lcm_destroy" and "lcm_publish" in the
same file.

I thought this might have something to do with the code I was writing
so I tried compiling the tutorial example and got the same error so I
suspect it's my install...

Does anyone have an idea's about this?

Albert Huang

unread,
Jun 16, 2012, 2:55:34 PM6/16/12
to lcm-...@googlegroups.com
Hi Chad,

It sounds like you're not linking your program correctly. Are you
using -llcm or `pkg-config --libs lcm` ?

Albert
> --
> You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
> To post to this group, send email to lcm-...@googlegroups.com.
> To unsubscribe from this group, send email to lcm-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/lcm-users?hl=en.
>

Chad Schaffer

unread,
Jun 20, 2012, 1:01:42 PM6/20/12
to lcm-...@googlegroups.com

I'm a novice to programming, and am not sure where these commands should be used.  I have used neither "-llcm" nor "pkg-config --libs lcm".  Is this something done during install?  at what point should I used which command?

Albert Huang

unread,
Jun 20, 2012, 1:07:54 PM6/20/12
to lcm-...@googlegroups.com
Hi Chad,

I would suggest going through some introductory material on compiling
and linking. It's definitely something you'll want to be very
familiar with as you learn more about programming. Based on a cursory
google search, this page seems like it might have some useful
information: http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

Albert

Chad Schaffer

unread,
Jun 20, 2012, 1:08:47 PM6/20/12
to lcm-...@googlegroups.com
thank you so much!

atefe moosavi

unread,
Apr 13, 2015, 11:56:42 AM4/13/15
to lcm-...@googlegroups.com


dear Chad Schaffer
I am using lcm and have a same problem while compiling the lcm example! could you tell me what is the solution? could you compile it?
thanks

Andrea Nisticò

unread,
Mar 15, 2016, 12:03:34 PM3/15/16
to Lightweight Communications and Marshalling
I have the exact problem, how did you solve it? Thanks in advance

Chad Schaffer

unread,
May 18, 2020, 6:51:41 PM5/18/20
to Lightweight Communications and Marshalling
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.
Reply all
Reply to author
Forward
0 new messages