Ask Your Question
0

Undefined reference on Ubuntu 11.04

asked 2011-10-14 21:27:09 -0500

CaptainTrunky gravatar image

Hello! I have simple subscriber project, but there some problems. I'm using Ubuntu 11.04 2.6.38-11-generic, gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4), GNU ld (GNU Binutils for Ubuntu) 2.21.0.20110327 and GNU Make 3.81. I have

  1. /project/include/DepthListener.h,
  2. /project/src/DepthListener.cpp,
  3. /project/src/depthConverter.cpp.

When I try to make project, I receive next errors:

CMakeFiles/depthListener.dir/src/depthListener.o: In function `main':
/ros/depthListen/src/depthListener.cpp:6: undefined reference to `DepthConverter::DepthConverter()'
/ros/depthListen/src/depthListener.cpp:6: undefined reference to `DepthConverter::~DepthConverter()'
/ros/depthListen/src/depthListener.cpp:6: undefined reference to `DepthConverter::~DepthConverter()'
collect2: ld returned 1 exit status

As I undestand, make does not see DepthListener.cpp file and problem somewhere in CMakeLists.txt.

There are all files:

  1. DepthConverter.h

  2. CMakeLists.txt

  3. DepthConverter.cpp

  4. depthListener

Thanks for help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-10-15 02:24:40 -0500

I looked briefly at your CMakeLists, I think this should fix it:

rosbuild_add_executable(depthListener src/depthListener.cpp 
                                      src/depthConverter.cpp)
edit flag offensive delete link more

Comments

Thanks, it works fine! So silly mistake.
CaptainTrunky gravatar imageCaptainTrunky ( 2011-10-15 18:31:11 -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

Stats

Asked: 2011-10-14 21:27:09 -0500

Seen: 797 times

Last updated: Oct 15 '11