ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

ROS2 Beta2, how to include the RCL into Qt?

Hi everyone,
So earlier before I was using ROS2 beta1 version on Qt. It was working when I include the library files of ROS2 using Qt’s default way of add 3rd-party libraries. (right click on project and choose “add libraries” and so on…)

But when I switch to Beta2 version, this method doesn’t work anymore. I guess it’s because they introduced the commmand line tool like “ros2 run…” and somehow the way the static library linking to its dynamic library is changed?

Under Windows10, I tried adding the path “C:/dev/ros2/install/bin” into the environment variable PATH, but still it didn’t do the trick. So does anyone have an idea of how to properly import Beta2-Libraries in Qt?

Thanks a lot

The installation of executables to lib/<pkgname> instead of bin for the ros2 run command doesn’t affect the location of libraries. Therefore I don’t think this is related.

In general you don’t have to modify any environment variables if you do call the setup file (which will do that for you).

Maybe you can post more information, what the exact error message is as well as the steps you are doing. E.g. a reproducible example might help to give you more specific feedback what might be causing the problem.

Hi thomas,
Thank you for the reply!
How should I call the setup file inside qt?

The problem is: every time I use any function in rclcpp, for example, rclcpp::init(arg, argv), qt would crush at run time.
No error message from Qt it simply crushes. Building in Qt was fine.

For testing you can just import the two libraries: rclcpp and PocoFoundation.

Everything was working fine on Beta1 with Qt. Only with the Beta2 version, I have this problem.

Please refer to the instructions which describe how to use the setup file.

Please provide more information to allow others to help you. With the sparse information you have given I can’t provide any better feeedback.