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
)
add_executable(lj_cmd_interface src/lj_cmd_interface.cpp)
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="[email protected]">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...
Originally posted by francoisdtf on ROS Answers with karma: 62 on 2015-06-02
Post score: 0