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?
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.
By rhythmchicago in forum .NET
Last Post: 09-03-2009, 09:17 AM
Last Post: 05-13-2008, 04:20 AM
By deridder149 in forum Java
Last Post: 08-29-2007, 08:22 AM
By velkropie in forum Java
Last Post: 03-24-2007, 11:09 AM
By manik_gopal in forum Java
Last Post: 04-27-2006, 07:01 AM
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