Starting build ...
/ usr / bin / g ++ - 10 -g /home/andrey/Documents/testboost/bhkj.cpp -o / home / andrey / Documents / testboost / bhkj
/ usr / bin / ld: /tmp/cchGdzFn.o: in the function "boost :: asio :: detail :: posix_event :: posix_event ()":
/usr/include/x86_64-linux-gnu/boost/asio/detail/impl/posix_event.ipp:44: undefined reference to "pthread_condattr_setclock"
/ usr / bin / ld: /tmp/cchGdzFn.o: in the function "boost :: asio :: detail :: posix_thread :: ~ posix_thread ()":
/usr/include/x86_64-linux-gnu/boost/asio/detail/impl/posix_thread.ipp:35: undefined reference to "pthread_detach"
/ usr / bin / ld: /tmp/cchGdzFn.o: in the function "boost :: asio :: detail :: posix_thread :: join ()":
/usr/include/x86_64-linux-gnu/boost/asio/detail/impl/posix_thread.ipp:42: undefined reference to "pthread_join"
/ usr / bin / ld: /tmp/cchGdzFn.o: in the function "boost :: asio :: detail :: posix_thread :: start_thread (boost :: asio :: detail :: posix_thread :: func_base *)":
/usr/include/x86_64-linux-gnu/boost/asio/detail/impl/posix_thread.ipp:59: undefined reference to "pthread_create"
collect2: error: ld returned 1 exit status
Asked
Active
Viewed 259 times
1

Evg
- 25,259
- 5
- 41
- 83

Andreyprogramistr
- 21
- 1
-
4Looks like you forgot to link with the pthread library. Use `-lpthread` – Barmar Jul 21 '21 at 19:38
-
If you use C++11 or later, you can use `std::thread`. – Eljay Jul 21 '21 at 20:41