samedi 30 mai 2015

Thread was not delcared in this scope error

I am learning concurrent programing with c++ and I have a problem. I get en error: "thread was not declared in this scope error"

with this code:

#include <iostream>
#include <thread>
using namespace std;

void function1(){
    cout << "Beauty is only skin deep" << endl;
}

int main(){
    thread t1(function1);
    return 0;
}

I am using CodeBlock and I have enabled this option in compiler settings: "Have g++ follow the C++11 ISO C++ language standard [-std=c++11]"

I am using C++11 a lot and this is only thing that doesn't work. How to fix that ?

My operatins system is WIndows XP and compiler is GNU GCC

EDIT:

my PATH: "D:\Aplikacje\NVIDIA Corporation\PhysX\Common;C:\Documents and Settings\All Users\Dane aplikacji\Oracle\Java\javapath;D:\Aplikacje\Borland\CBUILD~1\Bin;D:\Aplikacje\Borland\CBUILD~1\Projects\Bpl;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\PROGRAM FILES\QUICKTIME\QTSYSTEM;%PROGRAMFILES%\Internet Explorer;C:\Program Files\QuickTime\QTSystem\;C:\xampp\mysql\lib;D:\aplikacje\Java\jdk1.8.0_45\bin;D:\Aplikacje\MATLAB\R2011a\runtime\win32;D:\Aplikacje\MATLAB\R2011a\bin"

EDIT2: Full compiler output:

"||=== ewghm, Debug ===| C:\Documents and Settings\KM\Pulpit\PROGRAMY\ewghm\main.cpp||In function 'int main()':|

C:\Documents and Settings\KM\Pulpit\PROGRAMY\ewghm\main.cpp|10|error: 'thread' was not declared in this scope|

C:\Documents and Settings\KM\Pulpit\PROGRAMY\ewghm\main.cpp|10|error: expected ';' before 't1'|

||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===| "

Aucun commentaire:

Enregistrer un commentaire