Home Contact Sitemap

洛星ロボット研究部 開発日誌

洛星中学高等学校のロボット研究部・同好会のブログです。

    アーカイブ
    ブログロール
    • happybusy
    Amazonサーチ
«

Boost AsioをUbuntu 20.04で使用する際にリンカエラーではまった

どうも。66thのSoulaです。

今回は、g++でBoost Asioを使用する際にリンカエラーではまったので解決法と経緯を書いておきます。

解決法 g++の引数に -lboost_pthreadを付加する。

経緯 Boost Asioを用いてシリアル通信を行おうとしたところ、下記のようなリンカエラーが発生しました。

usr/bin/ld: /tmp/cc0BvY7L.o: in function boost::asio::detail::posix_event::posix_event()': main.cpp:(.text._ZN5boost4asio6detail11posix_eventC2Ev[_ZN5boost4asio6detail11posix_eventC5Ev]+0x51): undefined reference topthread_condattr_setclock’
/usr/bin/ld: /tmp/cc0BvY7L.o: in function boost::asio::detail::posix_thread::~posix_thread()': main.cpp:(.text._ZN5boost4asio6detail12posix_threadD2Ev[_ZN5boost4asio6detail12posix_threadD5Ev]+0x2a): undefined reference topthread_detach’
/usr/bin/ld: /tmp/cc0BvY7L.o: in function boost::asio::detail::posix_thread::join()': main.cpp:(.text._ZN5boost4asio6detail12posix_thread4joinEv[_ZN5boost4asio6detail12posix_thread4joinEv]+0x2f): undefined reference topthread_join’
/usr/bin/ld: /tmp/cc0BvY7L.o: in function boost::asio::detail::posix_thread::start_thread(boost::asio::detail::posix_thread::func_base*)': main.cpp:(.text._ZN5boost4asio6detail12posix_thread12start_threadEPNS2_9func_baseE[_ZN5boost4asio6detail12posix_thread12start_threadEPNS2_9func_baseE]+0x3e): undefined reference topthread_create’
/usr/bin/ld: /tmp/cc0BvY7L.o: in function boost::asio::detail::posix_signal_blocker::posix_signal_blocker()': main.cpp:(.text._ZN5boost4asio6detail20posix_signal_blockerC2Ev[_ZN5boost4asio6detail20posix_signal_blockerC5Ev]+0x68): undefined reference topthread_sigmask’
/usr/bin/ld: /tmp/cc0BvY7L.o: in function boost::asio::detail::posix_signal_blocker::~posix_signal_blocker()': main.cpp:(.text._ZN5boost4asio6detail20posix_signal_blockerD2Ev[_ZN5boost4asio6detail20posix_signal_blockerD5Ev]+0x31): undefined reference topthread_sigmask’
collect2: error: ld returned 1 exit status

By Soula . 2020-06-21 . 13:16
コメントお待ちしております! Filed under: 未分類

コメントはありません »

コメントお待ちしております!

RSS feed for comments on this post. TrackBack URL

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>