DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    369

    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
    Posts
    4,118
    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

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links