dimanche 7 juillet 2019

note: 'std::thread' is defined in header '

I try to compile a simple c++ code in c++, but keep returning errors when I try to compile it with g++ in windows.

I use

g++ -std=c++0x -pthread main.cpp

The error messages are:

std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?

Which doesn't make sense because the code is just

#include<thread>

void f(int i) {}

int main() {
        std::thread t(f, 1);
        t.join();
        return 0;
}

I believe this code works in linux, I wonder why it can't work under windows.

Aucun commentaire:

Enregistrer un commentaire