Ask Your Question
0

Undefined reference in cvBridge.h

asked 2012-05-16 11:42:36 -0500

StFS gravatar image

updated 2014-01-28 17:12:20 -0500

ngrennan gravatar image

I just updated to Fuerte and Ubuntu 12.04 and I'm trying to build my ROS pacakges on it.

I'm getting errors in my OpenCV code which may be because the OpenCV code I'm building is a little old.

Here's the full build log for the package that's giving me errors: http://paste.ubuntu.com/991395/

And here's the code for ImageRecording.cpp (which seems to be the source of all these 'undefined reference' errors): http://paste.ubuntu.com/991411/

What I'm confused about is that I'm not getting a compiler error, but a linker error. I would have understood getting a compiler error since the code is outdated and maybe the API we were using back then is not supported anymore, but a linker error indicates that the same API is still there but somehow the setup of the whole thing is broken in some way.

Any insight into this would be greatly appreciated.

Kind regards, Stefan Freyr.

edit retag flag offensive close merge delete

Comments

Just for the record, I tried creating a brand new node following the tutorial I found here: http://www.ros.org/wiki/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages

I have the same problem there, getting a bunch of "undefined reference" linker errors when I try to build.

StFS gravatar imageStFS ( 2012-05-16 12:02:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-05-16 14:22:04 -0500

Kevin gravatar image

updated 2012-05-16 14:52:38 -0500

What does your CMakeLists.txt look like? Are you finding and linking OpenCV to your program? Double check that.

Also try changing your include to:

#include <cv_bridge/cv_bridge.h>
edit flag offensive delete link more

Comments

I did try using the #include <cv_bridge/cv_bridge.h> in my test node (the one I mention in the comment above).

My CMakeLists.txt does not have a reference to OpenCV as there is no mention of that in the tutorial. I do have a dependency in my manifest file. Isn't that enough?

StFS gravatar imageStFS ( 2012-05-20 23:45:41 -0500 )edit

I finally read properly through http://www.ros.org/wiki/opencv2 and noticed the following paragraph: "Please transition away from using <depend package="opencv2" /> to link against OpenCV in your packages. Standard CMake mechanisms (e.g. find_package()) are now the preferred way of linking against"

StFS gravatar imageStFS ( 2012-05-22 06:21:32 -0500 )edit

I have this exact problem. I tried adding target_link_libraries(path to libcv_bridge.so) in my CMakeLists, but it still reports the undefined reference. Or am I still such a newbie at C++ that I didn't link it properly?

kameleon gravatar imagekameleon ( 2012-10-27 09:13:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-05-16 11:42:36 -0500

Seen: 1,114 times

Last updated: May 16 '12