Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Howto: Install Boost from source

  1. #11
    Join Date
    Feb 2011
    Beans
    1

    Re: Howto: Install Boost from source

    I followed the above script. Now the header are in /usr/local/include and the builded libraries in /usr/local/lib. I tired to compile the example in test.cpp:

    Code:
    #include <boost/thread.hpp> 
    #include <iostream> 
    
    void wait(int seconds) 
    { 
      boost::this_thread::sleep(boost::posix_time::seconds(seconds)); 
    } 
    
    void thread() 
    { 
      for (int i = 0; i < 5; ++i) 
      { 
        wait(1); 
        std::cout << i << std::endl; 
      } 
    } 
    
    int main() 
    { 
      boost::thread t(thread); 
      t.join(); 
    }
    For compiling I use

    g++ test.cpp -otest

    I get the following error messages:

    Code:
    test.cpp:(.text+0x9f): undefined reference to `boost::thread::join()'
    test.cpp:(.text+0xab): undefined reference to `boost::thread::~thread()'
    test.cpp:(.text+0xca): undefined reference to `boost::thread::~thread()'
    /tmp/ccNPcdEE.o: In function `boost::detail::thread_data_base::thread_data_base()':
    test.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[boost::detail::thread_data_base::thread_data_base()]+0x26): undefined reference to `vtable for boost::detail::thread_data_base'
    /tmp/ccNPcdEE.o: In function `void boost::this_thread::sleep<boost::posix_time::seconds>(boost::posix_time::seconds const&)':
    test.cpp:(.text._ZN5boost11this_thread5sleepINS_10posix_time7secondsEEEvRKT_[void boost::this_thread::sleep<boost::posix_time::seconds>(boost::posix_time::seconds const&)]+0x35): undefined reference to `boost::this_thread::sleep(boost::posix_time::ptime const&)'
    /tmp/ccNPcdEE.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)':
    test.cpp:(.text._ZN5boost6threadC1IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)]+0x32): undefined reference to `boost::thread::start_thread()'
    /tmp/ccNPcdEE.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
    test.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED1Ev[boost::detail::thread_data<void (*)()>::~thread_data()]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
    /tmp/ccNPcdEE.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
    test.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED0Ev[boost::detail::thread_data<void (*)()>::~thread_data()]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
    /tmp/ccNPcdEE.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo for boost::detail::thread_data<void (*)()>]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
    collect2: ld returned 1 exit status
    Does anybody know, where the mistake is?

    Regards

  2. #12
    Join Date
    May 2010
    Beans
    5

    Re: Howto: Install Boost from source

    I have exactly the same problem.

  3. #13
    Join Date
    Mar 2010
    Beans
    11

    Re: Howto: Install Boost from source

    Quote Originally Posted by auiG View Post
    I followed the above script. Now the header are in /usr/local/include and the builded libraries in /usr/local/lib. I tired to compile the example in test.cpp:

    ...

    For compiling I use

    g++ test.cpp -otest
    try to compile it with:

    Code:
    g++ test.cpp -otest -I/usr/local/include -L/usr/local/lib -lboost_thread

  4. #14
    Join Date
    Jul 2013
    Beans
    1

    Re: Howto: Install Boost from source

    Have a problem based on your post I thought you might help. Was happily using Eclipse, BJAM & QT on Ubuntu for C++ development . I then used synaptic to upgrade to newest LST release of Ubuntu, (12.04). After upgrade my builds no longer work. I get error messages from BJAM complaining about jamfiles that previously worked perfectly.
    example
    jamfile contains:
    SHELL "mkdir -vp $(SOLUTION_ROOT)/log $(SOLUTION_ROOT)/conf" ;
    bjam reports error:
    /home/ccervo/LoggerWrk/cipLogger/src/Jamfile:31: in modules.load
    *** argument error
    * rule SHELL ( command : * )
    * called with: ( )
    * missing argument command
    (builtin):see definition of rule 'SHELL' being called

    I strongly suspect the upgrade did not properly install bjam or some associated libraries or tools.

    Can you advise on best way to uninstall or clean-up bjam and then reinstall or advise on some other method to troubleshoot.?

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •