ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Tommy Hay's profile - activity

2019-03-01 16:36:08 -0500 marked best answer fatal error: ros/ros.h: No such file or directory

I have created a package using catkin_create_pkg on PC where I have previously installed Ubuntu 16.04 LTS and ROS kinetic. But I am trying to compile the cpp file included in the created package I get the following error

my@my-MS-7972:~/catkin_ws/src/sample_opencv/src$ g++ test_cv_bridge.cpp
test_cv_bridge.cpp:1:21: fatal error: ros/ros.h: no such file or directory
compilation terminated.

looks like it does not see any of the header files included in my cpp file.

Edit: This is what I added to my package.xml

<buildtool_depend>catkin</buildtool_depend><build_depend>cv_bridge</build_depend><build_depend>image_transport</build_depend><build_depend>roscpp</build_depend><build_depend>sensor_msgs</build_depend><build_depend>std_msgs</build_depend><build_export_depend>cv_bridge</build_export_depend><build_export_depend>image_transport</build_export_depend><build_export_depend>roscpp</build_export_depend><build_export_depend>sensor_msgs</build_export_depend><build_export_depend>std_msgs</build_export_depend><exec_depend>cv_bridge</exec_depend><exec_depend>image_transport</exec_depend><exec_depend>roscpp</exec_depend><exec_depend>sensor_msgs</exec_depend><exec_depend>std_msgs</exec_depend>

here is the Cmakelist.txt:

cmake_minimum_required(VERSION 2.8.3)
project(sample_opencv)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
make_minimum_required(VERSION 2.8.3)
project(sample_opencv)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(cat
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  sensor_msgs
  std_msgs
)

find_package(OpenCV REQUIRED)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
##   * add a build_depend tag for "message_generation"
##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in
##     but can be declared for certainty nonetheless:
##     * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
##   * add "message_generation" and every package in MSG_DEP_SET to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * add "message_runtime" and every package in MSG_DEP_SET to
##     catkin_package(CATKIN_DEPENDS ...)
##   * uncomment the add_*_files sections below as needed
##     and list every .msg/.srv/.action file to be processed
##   * uncomment the generate_messages entry below
##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
#   FILES
#   Message1.msg
#   Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
#   FILES
#   Action1.action
#   Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
#   DEPENDENCIES
#   sensor_msgs#   std_msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
##   * add a build_depend and ...
(more)
2019-03-01 16:34:59 -0500 marked best answer Invoking "cmake" failed

I have previously installed Ubuntu 16.04 LTS and ROS kinetic on PC. I try to practice tutorial according this ( http://wiki.ros.org/cv_bridge/Tutoria... )

I create a package using catkin_create_pkg sample_opencv_pkg sensor_msgs opencv2 cv_bridge rospy std_msgs. the terminal shows

Created file sample_opencv_pkg/CMakeLists.txt
Created file sample_opencv_pkg/package.xml
Created folder sample_opencv_pkg/src
Successfully created files in /home/my/catkin_ws/src/sample_opencv_pkg. Please adjust the values in package.xml.

Then I change direction to catkin_ws ,and use catkin_make .The terminal show the following error:

Base path: /home/my/catkin_ws
Source space: /home/my/catkin_ws/src
Build space: /home/my/catkin_ws/build
Devel space: /home/my/catkin_ws/devel
Install space: /home/my/catkin_ws/install
####
#### Running command: "cmake /home/my/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/my/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/my/catkin_ws/install -G Unix Makefiles" in "/home/my/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/my/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/my/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/my/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/my/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.11
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 9 packages in topological order:
-- ~~  - turtlebot3 (metapackage)
-- ~~  - turtlebot3_msgs
-- ~~  - turtlebot3_navigation
-- ~~  - sample_opencv_pkg
-- ~~  - turtlebot3_bringup
-- ~~  - turtlebot3_example
-- ~~  - turtlebot3_slam
-- ~~  - turtlebot3_teleop
-- ~~  - turtlebot3_description
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'turtlebot3'
-- ==> add_subdirectory(turtlebot3/turtlebot3)
-- +++ processing catkin package: 'turtlebot3_msgs'
-- ==> add_subdirectory(turtlebot3_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- turtlebot3_msgs: 3 messages, 0 services
-- +++ processing catkin package: 'turtlebot3_navigation'
-- ==> add_subdirectory(turtlebot3/turtlebot3_navigation)
-- +++ processing catkin package: 'sample_opencv_pkg'
-- ==> add_subdirectory(sample_opencv_pkg)
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
  Could not find a package configuration file provided by "opencv2" with any
  of the following names:

    opencv2Config.cmake
    opencv2-config.cmake

  Add the installation prefix of "opencv2" to CMAKE_PREFIX_PATH or set
  "opencv2_DIR" to a directory containing one of the above files.  If
  "opencv2" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  sample_opencv_pkg/CMakeLists.txt:10 (find_package)


-- Could not find the required component 'opencv2'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "opencv2" with any
  of the following names:

    opencv2Config.cmake
    opencv2-config.cmake
"opencv2" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  sample_opencv_pkg/CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/my/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/my/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

  Add the installation prefix of "opencv2" to CMAKE_PREFIX_PATH or set
  "opencv2_DIR" to a directory containing one of the above files ...
(more)
2018-11-26 08:17:23 -0500 received badge  Famous Question (source)
2018-11-11 12:34:58 -0500 received badge  Famous Question (source)
2018-08-22 01:45:47 -0500 received badge  Notable Question (source)
2018-08-13 16:01:28 -0500 received badge  Popular Question (source)
2018-08-12 04:46:19 -0500 edited question Invoking "cmake" failed

Invoking "cmake" failed I have previously installed Ubuntu 16.04 LTS and ROS kinetic on PC. I try to practice tutorial

2018-08-12 04:46:19 -0500 received badge  Editor (source)
2018-08-12 04:44:36 -0500 asked a question Invoking "cmake" failed

Invoking "cmake" failed I have previously installed Ubuntu 16.04 LTS and ROS kinetic on PC. I try to practice tutorial

2018-08-12 03:35:02 -0500 received badge  Notable Question (source)
2018-08-11 23:57:58 -0500 commented question fatal error: ros/ros.h: No such file or directory

I do these step ,still have same problem

2018-08-11 11:14:15 -0500 received badge  Popular Question (source)
2018-08-11 02:46:26 -0500 edited question fatal error: ros/ros.h: No such file or directory

fatal error: ros/ros.h: No such file or directory I have created a package using catkin_create_pkg on PC where I have p

2018-08-11 02:45:16 -0500 asked a question fatal error: ros/ros.h: No such file or directory

fatal error: ros/ros.h: No such file or directory I have created a package using catkin_create_pkg on PC where I have p

2018-07-16 10:41:03 -0500 asked a question Trouble with launching Open-Ni

Trouble with launching Open-Ni I use ros several times,so I am not familiar with ros. My desktop install ubuntu 16.04 LT