Ask Your Question
0

catkin_make error

asked 2020-06-13 18:02:59 -0600

Michelle gravatar image

I'm new to ROS and I'm having problems using the catkin_make command. When used I get the error below.Does anyone know how to fix this?

Here's my code below:

michelle@michelle-VirtualBox:~/catkin_ws$ catkin_make
Base path: /home/michelle/catkin_ws
Source space: /home/michelle/catkin_ws/src
Build space: /home/michelle/catkin_ws/build
Devel space: /home/michelle/catkin_ws/devel
Install space: /home/michelle/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/michelle/catkin_ws/build"
####
####
#### Running command: "make -j1 -l1" in "/home/michelle/catkin_ws/build"
####
[  1%] Building CXX object ros_essentials_cpp/CMakeFiles/open_copy_cpp.dir/src/topic03_perception/cpp/open_copy.cpp.o
/home/michelle/catkin_ws/src/ros_essentials_cpp/src/topic03_perception/cpp/open_copy.cpp:1:10: fatal error: highgui.h: No such file or directory
    1 | #include <highgui.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [ros_essentials_cpp/CMakeFiles/open_copy_cpp.dir/build.make:63: ros_essentials_cpp/CMakeFiles/open_copy_cpp.dir/src/topic03_perception/cpp/open_copy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:474: ros_essentials_cpp/CMakeFiles/open_copy_cpp.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j1 -l1" failed
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-06-15 16:33:48 -0600

ffusco gravatar image

To build the code, the compiler looks for a header file named "highgui.h", but it is not able to locate it. This is most likely due to some missing instruction in the CMakeLists.txt file, which is not telling the compiler where the file can be located. Without knowing what you are trying to compile, it is a little hard to give an exact answer. However, here there are three candidate ways to solve the issue:

Case 1: the header is part of your package

According to the guidelines, the headers of a package named pkg_name should be located in the folder include/pkg_name. In this case, it is common to write in the CMakeLists.txt the following (after catkin_package but before any add_executable):

include_directories(include)

You would then be able to locate headers by writing something like: #include <pkg_name/header.h>. Note that, since in your error the missing header is not in this form, this case is not likely the one you need to focus on. However, I put it here for completeness.

Case 2: the header is part of another catkin package

Let's say that the header belongs to some_pkg. In you CmakeLists, you should locate the line in which you find other catkin packages, and make sure that some_pkg is there:

find_package(catkin REQUIRED COMPONENTS some_pkg ...)

Then, you must make sure that the headers from catkin packages are visible:

include_directories(${catkin_INCLUDE_DIRS})

Case 3: the header is part of another non-catkin package

Well, in this case there are too many possibilities to discuss... If you are "lucky", the header is part of some package external_pkg that can be easily located and included using CMake:

find_package(external_pkg REQUIRED)
...
include_directories(${external_pkg_INCLUDE_DIRS})
edit flag offensive delete link more
0

answered 2021-11-17 15:03:19 -0600

Titan gravatar image

try to include the library like this:

include "opencv2/highgui/highgui.hpp"

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-06-13 12:36:00 -0600

Seen: 714 times

Last updated: Nov 17