Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Devil0150

Member Since 13 Apr 2009
Offline Last Active Sep 28 2013 07:27 AM

#5058968 C++ 11 thread not working on CodeBlocks

Posted by Devil0150 on 03 May 2013 - 10:51 AM

Ok I'll try the latest one I can find on the MinGW website.




#5058964 C++ 11 thread not working on CodeBlocks

Posted by Devil0150 on 03 May 2013 - 10:41 AM

Yes I'm using MinGW. I didn't know it doesn't suport c++11 threading yet. I'll try something else. Thanks




#5058958 C++ 11 thread not working on CodeBlocks

Posted by Devil0150 on 03 May 2013 - 10:21 AM

I wanted to try out the new std::thread in C++11 in Code Blocks and I'm not sure if I'm doing it right.

This is the code:

#include <iostream>
#include <thread>

void foo()
{
    std::cout << "\n thread started. \n";
}

int main()
{
    std::cout << "starting thread";
    std::thread thr1(foo);

    std::cout << "waiting for thread to finish\n";
    thr1.join();

    std::cout << "done!\n";
    return 0;
}

 

At first I got some kind of warning that I had to use a compiler flag (-std=c++11), so I did.

And now I get 'thread is not a member of std'
 

I'm using GNU GCC compiler on windows 7. What should I do?




PARTNERS