roscpp dependency error
Platform: ROS Melodic on Debian Stretch IDE: QtCreator
Hello,
I strictly followed installation guide and package creating tutorial on a fresh install of Debian Stretch for Ros Melodic to install my environment. Then I created a package using catkin_create_pkg
in a workspace that is tested to be valid. Then I followed IDE's wiki page steps to write a piece of C++ code to try if it is working but I got a roscpp dependency error from CMAKE Could not find a package configuration file provided by "roscpp" with any
of the following names:
Afterwards I tried to do it with catkin tools on a separate workspace using catkin create pkg and followed the steps for it again but still the same error.
Here is my CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(pkg_a)
find_package(catkin REQUIRED COMPONENTS
roscpp
)
include_directories(
${catkin_INCLUDE_DIRS}
)
I have three lines in my .bashrc file for sourcing the packages.
source /opt/ros/melodic/setup.bash
source /home/<username>/catkin_ws/devel/setup.bash
source /home/<username>/pkg_ws/devel/setup.bash
#The last line added later on after trying to find a way with catkin tools
Links to the guides I followed
Installation: http://wiki.ros.org/melodic/Installat...
To setup the environment: http://wiki.ros.org/ROS/Tutorials/Ins...
To build packages with catkin_make: http://wiki.ros.org/ROS/Tutorials/Bui...
IDE setup: http://wiki.ros.org/IDEs
Output of env | grep -i ros | sort
CMAKE_PREFIX_PATH=/home/<username>/pkg_ws/devel:/home/<username>/catkin_ws/devel:/opt/ros/melodic
LD_LIBRARY_PATH=/home/<username>/pkg_ws/devel/lib:/home/<username>/catkin_ws/devel/lib:/opt/ros/melodic/lib
PATH=/opt/ros/melodic/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PKG_CONFIG_PATH=/home/<username>/pkg_ws/devel/lib/pkgconfig:/home/<username>/catkin_ws/devel/lib/pkgconfig:/opt/ros/melodic/lib/pkgconfig
PYTHONPATH=/home/<username>/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/melodic/lib/python2.7/dist-packages
ROS_DISTRO=melodic
ROS_ETC_DIR=/opt/ros/melodic/etc/ros
ROSLISP_PACKAGE_DIRECTORIES=/home/<username>/pkg_ws/devel/share/common-lisp:/home/<username>/catkin_ws/devel/share/common-lisp
ROS_MASTER_URI=http://localhost:11311
ROS_PACKAGE_PATH=/home/<username>/pkg_ws/src/pkg_a:/home/<username>/catkin_ws/src:/opt/ros/melodic/share
ROS_PYTHON_VERSION=2
ROS_ROOT=/opt/ros/melodic/share/ros
ROS_VERSION=1
rospack find roscpp
/opt/ros/melodic/share/roscpp
@Solved
If anybody has the same issue; I made it work through making the changes to QtCreator in the IDEs wiki page section 3. catkin tools but made it run through the 2. method (catkin_make)
Please always link to any tutorials/guides/howtos/documentation you are using.
We don't always know what you refer to.
Edit: also add the output of
env | grep -i ros | sort
androspack find roscpp
to your question text. Use theedit
button/link for that.which directory did you run catkin_create_pkg? Also, is that your entire CMakelists file? I didn't see where you declared your cpp executable or linked the catkin libraries
@prefpkg21
Managed to run CMake succesfully after creating a package using catkin tools but this time ros.h file couldn't be found.
does the CMakelists portion of your original post reflect the current file in your package?
@prefpkg21
Actually yes, but the package created with catkin_create_pkg started working now. Thank you for the help
Please post your last edit as an answer and then accept your own answer.
@gvdhoorn Sorry I couldn't accept my answer because I dont have enough points.