Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:05:00+00:00 2026-06-07T18:05:00+00:00

I installed boost library. Everything is going OK without multithreading. How do i compile

  • 0

I installed boost library. Everything is going OK without multithreading.
How do i compile this test program ?

#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std; 

void hello_world() {
  cout << "I'm new thread!" << endl;
}

int main(int argc, char* argv[]) {     
  boost::thread my_thread(&hello_world);
  my_thread.join();

  return 0;
}

I used: g++ -I/home/user/boost/include testc.cpp

but g++ show me:

/tmp/ccQtBeSf.o: In function `main':
testc.cpp:(.text+0x5a): undefined reference to `boost::thread::join()'
/tmp/ccQtBeSf.o: In function `__static_initialization_and_destruction_0(int, int)':
testc.cpp:(.text+0xd5): undefined reference to `boost::system::generic_category()'
testc.cpp:(.text+0xdf): undefined reference to `boost::system::generic_category()'
testc.cpp:(.text+0xe9): undefined reference to `boost::system::system_category()'
/tmp/ccQtBeSf.o: In function `boost::thread_exception::thread_exception(int, char const*)':
testc.cpp:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x7): undefined reference to `boost::system::system_category()'
/tmp/ccQtBeSf.o: In function `boost::detail::thread_data_base::thread_data_base()':
testc.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x1a): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccQtBeSf.o: In function `boost::thread::~thread()':
testc.cpp:(.text._ZN5boost6threadD2Ev[_ZN5boost6threadD5Ev]+0xe): undefined reference to `boost::thread::detach()'
/tmp/ccQtBeSf.o: In function `boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)':
testc.cpp:(.text._ZN5boost6threadC2IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[_ZN5boost6threadC5IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE]+0x23): undefined reference to `boost::thread::start_thread()'
/tmp/ccQtBeSf.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
testc.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x16): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccQtBeSf.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo for boost::detail::thread_data<void (*)()>]+0x8): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: ld returned 1 exit status
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:05:02+00:00Added an answer on June 7, 2026 at 6:05 pm

    You need to link with the Boost thread library as well:

    g++ -I/home/user/boost/include testc.cpp -L/home/user/boost/lib -lboost_thread
    

    (Assuming the libraries are in /home/user/boost/lib.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have boost installed under /home/username/local/include . I want to compile a library with
hi am trying to compile a simple program in boost library but i keep
So I've got boost installed in C:\Program Files\boost_1_47_0\, with the library files in ./stage/lib/
I'm trying to compile a C++ program under Ubuntu 11.10 using boost 1.42 installed
Steps: 1. sudo port boost The boost file installed in /opt/local/boost, library files are
I just installed boost 1.42.0 from macports using sudo port install boost . Everything
I'm trying to build TorTunnel on my mac. I've successfully installed the Boost library
I have compiled and installed my boost library in '/media/data/bin' in ubuntu 9.10. And
I just installed the boost library on Linux and written a sample application :
I'm having trouble building a little program that uses Boost.Test on my Mac with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.