# Undefined reference on roscpp functions

Hi everyone,

I'm stuck with a linking problem for a while now, I tried many stuff and browsed the forum but couldn't find my exact problem. It must be quite stupid though, since it seems to be a simple fail in linking roscpp.

When I tried to catkin_make my workspace, I get an undefined reference to any function from roscpp. It does not seem to be an inclusion problem since I have no error message about that, only this undefined reference issue.

I simplified my .cpp and my CMakelist.txt to the maximum but still get the same problem. Here are the exact files I'm trying :

CMakelist.txt :

cmake_minimum_required(VERSION 2.8.3)
project(myproject)

if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif() find_package( catkin REQUIRED COMPONENTS roscpp rospy ) include_directories( include${catkin_INCLUDE_DIRS}
)

catkin_package(
INCLUDE_DIRS include
LIBRARIES myproject
CATKIN_DEPENDS roscpp rospy
DEPENDS system_lib
)

target_link_libraries(lj_cmd_interface ${CATKIN_LIBRARIES})  package.xml : <?xml version="1.0"?> <package> <name>myproject</name> <version>0.0.0</version> <description></description> <maintainer email="me@me.com">Me</maintainer> <license>BSD</license> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <run_depend>roscpp</run_depend> <run_depend>rospy</run_depend> </package>  And even the simplest cpp code doesn't work : #include "ros/ros.h" int main(int argc, char **argv){ ros::init(argc, argv, "mynode"); return 0; }  I guess the solution must be quite straightforward once you get it, but after almost a whole day searching for it I must admit I couldn't see it... edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted target_link_libraries(lj_cmd_interface${CATKIN_LIBRARIES})


If that is an actualy copy/paste, then you should change CATKIN_LIBRARIES to catkin_LIBRARIES (note the case change).

more

That was an actual copy paste. Thank you and sorry for the trouble, that was the issue.

( 2015-06-02 09:13:28 -0600 )edit