0

I have a problem with using Threads in C++. I read this topic: How to make CDT/Eclipse work with C++11 threads? But it didn't help at all :( So, from the beginning. I'm trying to 'convert' big project from Visual Studio into Eclipse and I'm forcing with a problem with threads. So I created another Eclipse project in order to test that.

#include <iostream>
#include <thread>

void worker()
{
    std::cout << "hello from worker" << std::endl;
}

int main(int argc, char **argv)
{
    std::thread t(worker);
    t.join();
}

But, I get:

error: 'thread' is not a member of 'std'

In GCC C++ Compiler->Miscellaneous I have

-c -fmessage-length=0 -std=c++11 -pthread 

In MinGW C++ Linker->Libraries I have

pthread

Even in MinGW C++ Linker->Miscellaneous I have

-std=c++11

I'm a fresh user of Eclipse and I have no idea what I'm doing wrong. I would be very grateful for any tips :)

Arizaa
  • 1
  • 2
  • This is from a few (quite a few) years back: https://stackoverflow.com/questions/2519607/stdthread-error-thread-not-member-of-std might help you – pepperjack Dec 17 '17 at 19:05
  • Why dont you just use visual c++ compiler. Honestly visual cpp has alot of non standard cpp its easier to either start from scratch or stick with it. [using visual c++ compiler in eclipse](http://codewriterstips.blogspot.ug/2012/05/using-microsoft-c-compiler-with-eclipse.html) – JoshKisb Dec 17 '17 at 19:06
  • which compiler version are you using? – user7860670 Dec 17 '17 at 19:08
  • I'm using GCC(MinGW-W64) 7.1.0 – Arizaa Dec 17 '17 at 20:28

0 Answers0