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

I can't add a library to my workspace. Can someone help me out, please? [closed]

asked 2021-01-27 07:45:08 -0500

serhat gravatar image

updated 2021-01-29 00:49:08 -0500

Hello all, my problem seems very easy but I can't handle for 2 days. I just want to add a library to my program. The library's name is asio. What I want to do is exactly shown in this video( ) (ONLY time between 2:30~5:20)

What I did so far? I downloaded the zip file of asio library like said in the video and unzip it. Then I copy the include folder that is in the folder that I just unzip to usr/include/serhat folder.(serhat folder is a just empty folder to store this library) Then I include all .hpp files to my programs. After including header files, I can use benefits this library and even my IDE start showing shortcuts of the objects related to this library. But then I made catkin_make and I got some fatal errors written below:

/home/serhatsony/catkin_ws/src/using_markers/src/tcp_learning_04.cpp:41:30: fatal error: asio/awaitable.hpp: No such file or directory
compilation terminated.

How should I solve this problem? I am open for all kind of answers. How can I do what the guy did in this video on my Ros/Linux?

UBUNTU 16.04 - Kinetic - Ros1. I use Visual Studio as IDE.

Thank You!

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by serhat
close date 2021-04-27 08:33:09.853435


What package are you trying to build using catkin_make? Did you copy the above file to the package you are trying to build?

skpro19 gravatar image skpro19  ( 2021-01-28 00:53:15 -0500 )edit

Hello Shubham, thank you for your comment firstly. I downloaded the asio library. And it includes a lot files inside itself. I don't know which one I should include? In the video I mentioned, the guy links to "include" file in the asio library to directly his SDK. This library is actually header based so I should add this library by typing "#include <asio.hpp>" in my program. But of course I should indicate where the asio library that I downloaded is properly in my laptop. So, I copy to asio library to my usr/include file, thus I'd be able to use this library with normal condition. Isn't it? I guess there is something needed I need to do in CMakeList.txt or package.xml file. If you can suggest me a tutorial about that, I am very open. Thank you again.

serhat gravatar image serhat  ( 2021-01-29 00:48:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-01 00:17:53 -0500

serhat gravatar image

updated 2021-02-01 00:18:48 -0500

Hi all again, I solved my problem and wanted to add the solution here as well. In shortly, I downloaded asio library as standalone and unzip it. I created a directory called "asio" in my usr/include directory. After unzipping the library, I copy these files(asio-1.18.1/include/asio and asio-1.18.1/include/asio.hpp) to my usr/include/asio directory which I just created by myself. Since asio library is based on header files, I am able to use benefits of asio library now by just adding these includes:

#include <asio/asio.hpp> 
#include <asio/ts/buffer.hpp>
#include <asio/ts/internet.hpp>

I don't get any compiler error now. As you can see in my solution, I did not change anything in my CMakeList.txt or package.xml files. This is how I solved my problem. I hope that it works for you too.

edit flag offensive delete link more


hi @serhat can you please share you solution by stepwise.. Thanks in advance

Sam123 gravatar image Sam123  ( 2022-02-15 12:24:58 -0500 )edit

Hi @Shoukat.M, my solution is defined above actually, there is no addition step besides those I typed. Which particular step did you get stuck in?

serhat gravatar image serhat  ( 2022-02-16 02:10:27 -0500 )edit

hi @serhat it works, thank you !!!

ahmetalperenvar gravatar image ahmetalperenvar  ( 2023-03-21 09:24:08 -0500 )edit

Question Tools



Asked: 2021-01-27 07:45:08 -0500

Seen: 1,350 times

Last updated: Feb 01 '21