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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:17:21+00:00 2026-05-27T13:17:21+00:00

I am trying to compile some C++ code that uses threads: #include <iostream> #include

  • 0

I am trying to compile some C++ code that uses threads:

#include <iostream>
#include <thread>
void hello()
{
    std::cout<<"Hello Concurrent World\n";
}

int _main(int argc, _TCHAR* argv[])
{
    std::thread t(hello);
    t.join();
    return 0;
}

I get errors when compiling:

c:\temp\app1\app1\app1.cpp(6): fatal error C1083: Cannot open 
include file: 'thread': No such file or directory


~/Documents/C++ $ g++ -o thread1 thread1.cpp -D_REENTRANT -lpthread
In file included from /usr/include/c++/4.5/thread:35:0,
                 from thread1.cpp:2:
/usr/include/c++/4.5/bits/c++0x_warning.h:31:2: error: #error This file 
requires compiler and library support for the upcoming ISO C++ standard, 
C++0x. This support is currently experimental, and must be enabled with 
the -std=c++0x or -std=gnu++0x compiler options.

How do I fix these errors?

  • 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-27T13:17:22+00:00Added an answer on May 27, 2026 at 1:17 pm

    <thread> and standard threading support is a new feature (defined in the C++11 standard). As for g++, you have to enable it adding -std=c++0x to the command line, as explained in the error message.

    Also, you are using a nonstandard (Microsoft-specific) main, use the “classic” main and normal char:

    // thread1.cpp
    #include <iostream>
    #include <thread>
    
    void hello()
    {
        std::cout<<"Hello Concurrent World\n";
    }
    
    int main(int argc, char * argv[])
    {
        std::thread t(hello);
        t.join();
    
        return 0;
    }
    

    Notice that not all C++11 features are available in current compilers; as far as g++ is concerned, you can find the status of their implementation here.

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

Sidebar

Related Questions

I'm trying to compile some code that uses the fmemopen function in MinGW. I
This is the error I'm getting when trying to compile some code that uses
While trying to compile my project, that uses some third party headers, with mingw
I am new to Linux and I am trying to compile some code that
I'm trying to compile some code from a Windows API. It says that certain
I'm trying to convert to Java some code that uses SDL. I'm using the
I am trying to compile some code from a project that is no longer.
I'm trying to compile some code which contains the following declaration, because I would
I'm trying to compile with g++ some code previously developed under Visual C++ 2008
When trying to compile a file that include winnt.h via windows.h, I get the

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.