linking problem in my new package

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

linking problem in my new package

Ran Zask
Hi all.

I created a package of my own with dependencies. I have tracker_node.cpp (in src directory) with main only and include to tracker.h (in include and the .cpp in src directory)
When I compile I get this error:

[rosbuild] Building package tracker
[rosbuild] Including /home/ran/ros/ros/core/rospy/cmake/rospy.cmake
[rosbuild] Including /home/ran/ros/ros/core/roscpp/cmake/roscpp.cmake
[rosbuild] Including /home/ran/ros/pkgs/ros_experimental/rosjava/cmake/rosjava.cmake
[rosbuild] Including /home/ran/ros/pkgs/ros_experimental/rosclj/cmake/rosclj.cmake
[rosbuild] Including /home/ran/ros/pkgs/ros_experimental/roslisp/cmake/roslisp.cmake
[rosbuild] Including /home/ran/ros/pkgs/ros_experimental/rosoct/cmake/rosoct.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ran/Pursuit/Project/pursuit/tracker/build
cd build && make
make[1]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[2]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[3]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[3]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
[  0%] Built target rospack_gensrv_libexe
make[3]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[3]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
[  0%] Built target rospack_genmsg_libexe
make[3]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[3]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
[ 50%] Built target tracker
make[3]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[3]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[3]: Entering directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
Linking CXX executable ../../bin/tracker_node
CMakeFiles/tracker_node.dir/tracker_node.o: In function `main':
/home/ran/Pursuit/Project/pursuit/tracker/src/tracker_node.cpp:8: undefined reference to `Tracker::instance()'
/home/ran/Pursuit/Project/pursuit/tracker/src/tracker_node.cpp:8: undefined reference to `Tracker::start()'
collect2: ld returned 1 exit status
make[3]: *** [../bin/tracker_node] Error 1
make[3]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[2]: *** [src/CMakeFiles/tracker_node.dir/all] Error 2
make[2]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/ran/Pursuit/Project/pursuit/tracker/build'
make: *** [all] Error 2

The CMakelist in the main dir is:
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

#set(ROS_BUILD_TYPE RelWithDebInfo)
set(ROS_BUILD_TYPE Debug)
rosbuild_init()

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)


#rosbuild_gensrv()
rosbuild_add_boost_directories()

add_subdirectory(src)
The CMakelist in the src directory is :
rosbuild_add_library(tracker tracker.cpp)
rosbuild_add_executable(tracker_node tracker_node.cpp)

The manifest file:
<package>
  <description brief="A tracker"></description>
  <author>Abdul</author>
  <license>BSD</license>
  <export>
    <cpp cflags="-I${prefix}/include" lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -ltracker" />
  </export>
  <review status="unreviewed" notes=""/>
  <depend package="roscpp"/>
  <depend package="std_msgs"/>
  <depend package="sensor_msgs"/>
  <depend package="opencv2"/>
  <depend package="image_transport"/>


</package>

the Makefile:
          include $(shell rospack find mk)/cmake.mk

Any idea what I am doing wrong? both instance() and start() are in Tracker class in tracker.h file

Ran.


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
ros-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/ros-users