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

Revision history [back]

click to hide/show revision 1
initial version

A colleague of mine was seeing the same issue, but only with Qt5 (ROS kinetic on Ubuntu 16.04). You have a qt4_wrap_cpp command in there, though -- are you using Qt4 or Qt5?

I'll assume you need Qt5; he had to resolve a number of issues, and I don't recall which one exactly applied to the No such file or directory error. Making sure the following lines are in your CMakeLists.txt file will cover almost all the issues he had (note that I'm leaving out some parts, such as te catkin_package(...) section):

find_package(catkin REQUIRED COMPONENTS
  qt_build
  ...
)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Widgets)
qt5_add_resources(QT_RESOURCES_CPP ${QT_RESOURCES})
qt5_wrap_cpp(COMMON_MOC_FILES <your_files>)
...
add_executable(<your_exe> ...)
target_link_libraries(<your_exe> ${catkin_LIBRARIES} ${QT_LIBRARIES})

As I recall, it was the include_directories line above that solved the issue you're having. Also, don't forget to update your package.xml file, including:

<build_depend>qt_build<build_depend>
<run_depend>qt_build<run_depend>

To reiterate, the above assumes Qt5 (kinetic on Ubuntu 16.04); Qt4 requires a different CMakeLists.txt setup.