C++0x thread class: library dependency

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: C++0x thread class: library dependency

  1. #1
    Join Date
    Oct 2007

    C++0x thread class: library dependency

    In order to get g++ 4.5 (with -std=c++0x) to launch the new standard thread correctly, I had to link with -lpthread.
    I'm running on Linux, btw.
    I'm not surprised that g++ used pthreads, but I was surprised that I needed to add the link flag. Is this the expected behavior?
    In other words, are we doomed to have to specify the library implementation at link time, or should we expect the language now to do that automagically?

  2. #2
    Join Date
    Nov 2003
    No. that's not the standard behavior. The C++ standard doesn't even recognize pthreads so it certainly won't require that. However, I suspect that the GCC library used pthreads to implement the new threading facilities so it forces you to add that flag. It's remiscent of the early days of <iostream.h> when people had to #include <stdio.h> because the stream library was built upon stdio.
    Danny Kalev

Similar Threads

  1. Import Native C++ dll into C++ Class Library
    By rhythmchicago in forum .NET
    Replies: 0
    Last Post: 09-03-2009, 09:17 AM
  2. WPF to Class Library
    By shers in forum .NET
    Replies: 2
    Last Post: 05-13-2008, 04:20 AM
  3. Dynamic Loading.
    By deridder149 in forum Java
    Replies: 1
    Last Post: 08-29-2007, 08:22 AM
  4. Help with Error in class
    By velkropie in forum Java
    Replies: 5
    Last Post: 03-24-2007, 11:09 AM
  5. Replies: 4
    Last Post: 04-27-2006, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center