ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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})