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 3614672
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:16:43+00:00 2026-05-18T22:16:43+00:00

I wanted to use threads in my code and thought that the upcoming C++0x

  • 0

I wanted to use threads in my code and thought that the upcoming C++0x extensions would be handy as they will become a standard eventually. This seemed to be future-proof without the need to use additional libraries like the boost::thread.
Unfortunately I couldn’t find useful information about which features regarding threads are currently supported by gcc. I’m using unique_locks which seem not to work, yet. This is the output of the linker:

.build_debug/src/core/simulator.o: In function `Simulator::start(int, int, int, int)':
simulator.cpp:(.text+0x1fc): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
.build_debug/src/core/simulator.o: In function `Simulator::resume()':
simulator.cpp:(.text+0x351): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
.build_debug/src/core/simulator.o: In function `Simulator::pause()':
simulator.cpp:(.text+0x417): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
.build_debug/src/core/simulator.o: In function `Simulator::stop()':
simulator.cpp:(.text+0x4cd): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'

Does anybody understand these messages? I guess they are referring to the usage of unique_locks. But why do these errors occur?

My source code resembles this one:
std::unique_lock<std::mutex> lkIntra(intraMtx, std::defer_lock);
std::unique_lock<std::mutex> lkInter(interMtx, std::defer_lock);
std::lock(lkIntra, lkInter);

EDIT: I tried to compile this with gcc 4.3.X and 4.4.5. The linker was g++ 4.3, 4.4 and 4.5.

EDIT2: I just tried to use the boost equivalents to the std-threads. After adding the compiler flag “-lboost_thread” the compilation worked. Without which the linking process resulted in similar error messages. Now I’m wondering whether I need to do something alike when using standard threads (I already tried “-lpthread”).

  • 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-05-18T22:16:44+00:00Added an answer on May 18, 2026 at 10:16 pm

    The current development version of G++ supports it: http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00729.html

    The 4.5.1 version doesn’t seem to (at least, for me on Mac OS Intel).

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

Sidebar

Related Questions

I use emacs for viewing and editing code and other text files. I wanted
I wanted to know how to use threads in Cocoa. I'm new to this
I wanted to use boost::thread in my program, but get the following compiler error
I wanted to use T4 to generate properties for a partial class. I'm running
I have a DataSet populated from Excel Sheet. I wanted to use SQLBulk Copy
At present I am using eclipse for JAVA project. I always wanted to use
I wanted to know, while deciding which language or technology to use for implementing
The demos for the jquery ui dialog all use the flora theme. I wanted
I wanted some of those spiffy rounded corners for a web project that I'm
I'm back with another question concerning threads and synchronization. Imagine a server application that

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.