Code:
#include <iostream>
#include <thread>
using namespace std;
void hello(){
cout<<"Hello Concurrent World\n";
}
int main(){
thread t(hello);
t.join();
}
#include <iostream>
#include <thread>
using namespace std;
void hello(){
cout<<"Hello Concurrent World\n";
}
int main(){
thread t(hello);
t.join();
}
a greska je:
Citat:
PS C:\Users\marko\desktop> gcc -std=c++0x -o bla s.cpp
s.cpp: In function 'int main()':
s.cpp:11: error: 'thread' was not declared in this scope
s.cpp:11: error: expected ';' before 't'
s.cpp:12: error: 't' was not declared in this scope
s.cpp: In function 'int main()':
s.cpp:11: error: 'thread' was not declared in this scope
s.cpp:11: error: expected ';' before 't'
s.cpp:12: error: 't' was not declared in this scope
thread header postoji, eclipse ne prijavljuje gresku na: #include <thread>
EDIT: Da dodam samo MinGW installer nisam koristio jer instalira staru verziju gcc (3.4), pokusavao sam da instaliram sam sa uputstvom sa http://www.mingw.org/wiki/HOWT...l_the_MinGW_GCC_Compiler_Suite ali to je uputstvo za staru verziju.
[Ovu poruku je menjao the_tosic dana 17.12.2009. u 16:57 GMT+1]
EDIT2: deinstalirao sam TDM/MinGW i instalirao MinGW prema uputstvu: http://www.mingw.org/wiki/Getting_Started sada od gresaka izbacuje:
Citat:
C:\Users\wowex\Desktop> gcc -std=c++0x s.cpp -o bla
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ostream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iostream:40,
from s.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
s.cpp: In function 'int main()':
s.cpp:11: error: 'thread' was not declared in this scope
s.cpp:11: error: expected ';' before 't'
s.cpp:12: error: 't' was not declared in this scope
C:\Users\wowex\Desktop>
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ostream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iostream:40,
from s.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
s.cpp: In function 'int main()':
s.cpp:11: error: 'thread' was not declared in this scope
s.cpp:11: error: expected ';' before 't'
s.cpp:12: error: 't' was not declared in this scope
C:\Users\wowex\Desktop>
Ovo se ne pojavljuje kada prevodim normalan (bez thread-a) program i bez -std=c++0x parametra
[Ovu poruku je menjao the_tosic dana 17.12.2009. u 19:07 GMT+1]