How to include the ROS library to Qt with qmake? [closed]

asked 2020-09-19 08:35:47 -0500

miker2808 gravatar image

Hello, well in my defense, I spent roughly 4 hours, finding the solution to simply start what I wanted to do.. Obviously, i'm trying to make a GUI in Qt to subscribe and publish to ros. But i experience the problem with understanding how to do the most basic of it, get Qt to work with ROS. I tried the "catkin_create_qt_pk" and then run the CMakeLists.txt using Qt, there I always got some error, searching for the solution brought nothing new. so I tried to make it on my own, I want to include the ROS library to Qt. I want to use qmake for it, I've seen many posts saying "use cmake instead" I would, but I dont seem to understand what the hell is going on in there, and how to integrate ros with cmake manually. now I always programmed with Python, so i'm used to easily import everything. but with my research its far from close in C++.. I always used to write using only standard libraries, so I didn't ever include 3d part library to my c++ package. Now I would appreciate any help, I tried writing LIBS += /opt/ros/melodic/include/ros/ros.h and hope it'll do the trick, but nothing I tried using additionaly #Include </opt> at this point I get the error "no such file or directory time.h" tried to manually add #include</opt> and got the same error, somehow it doesn't show ros.h as being unable to include but time.h.. I'm i'm pretty sure if i'll solve the time.h include error, it'll pop the second header as error. I would appreciate ANY help, any guide, and I'll use any your method as long as I can simply get Qt to include ROS. Thanks in advance.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by miker2808
close date 2020-09-21 04:11:11.598767

Comments

@miker2808 what version of Qt are you using. Generally speaking the best approach is to include Qt libraries in the CMakeList.txt of your package. There are plenty of example on which you can base your project like this, this and this.

Weasfas gravatar image Weasfas  ( 2020-09-21 03:58:09 -0500 )edit

Thank you, I really did move to Cmake, even tho I found how to include the ROS Library to Qt with qmake, the idea is to use the Qt gui by right clicking the qmake file, and adding the pacckage "roscpp"

miker2808 gravatar image miker2808  ( 2020-09-21 04:10:58 -0500 )edit