Поддерживает ли gcc 4.7.1 темы?

Я следовал инструкцииВот при настройке CodeBlocks для использования GCC 4.7.1. пример, представленный на упомянутой мной странице, скомпилирован просто отлично, но когда я попытался скомпилировать следующий код, он впоследствии сгенерировал ошибки. Я должен сказать, что я даже установил компиляторы C + Флаг +11 через настройки компилятора (-std = c ++ 11), но все равно не повезло. Код, который не компилируется:

#include <iostream>
#include <thread>
#include <vector>

//This function will be called from a thread

void func(int tid) {
    std::cout << "Launched by thread " << tid << std::endl;
}

int main() {
    std::vector<std::thread> th;

    int nr_threads = 10;

    //Launch a group of threads
    for (int i = 0; i < nr_threads; ++i) {
        th.push_back(std::thread(func,i));
    }

    //Join the threads with the main thread
    for(auto &t : th){
        t.join();
    }

    return 0;
}

Ошибки:

 main.cpp||In function 'int main()':|
 main.cpp|13|error: 'thread' is not a member of 'std'|
 main.cpp|13|error: 'thread' is not a member of 'std'|
 main.cpp|13|error: template argument 1 is invalid|
 main.cpp|13|error: template argument 2 is invalid|
 main.cpp|13|error: invalid type in declaration before ';' token|
 main.cpp|19|error: request for member 'push_back' in 'th', which is of non-class type 'int'|
 main.cpp|19|error: 'thread' is not a member of 'std'|
 main.cpp|23|error: no matching function for call to 'begin(int&)'|
 main.cpp|23|note: candidates are:|
 \include\c++\4.7.1\initializer_list|89|note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)|
 \include\c++\4.7.1\initializer_list|89|note:   template argument deduction/substitution failed:|
 main.cpp|23|note:   mismatched types 'std::initializer_list<_Tp>' and 'int'|
 \include\c++\4.7.1\bits\range_access.h|87|note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])|
 \include\c++\4.7.1\bits\range_access.h|87|note:   template argument deduction/substitution failed:|
 main.cpp|23|note:   mismatched types '_Tp [_Nm]' and 'int'|
 \include\c++\4.7.1\bits\range_access.h|58|note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)|
 \include\c++\4.7.1\bits\range_access.h|58|note:   template argument deduction/substitution failed:|
 main.cpp|23|required from here|
 \include\c++\4.7.1\bits\range_access.h|58|error: request for member 'begin' in '__cont', which is of non-class type 'const int'|
 \include\c++\4.7.1\bits\range_access.h|48|note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)|
 \include\c++\4.7.1\bits\range_access.h|48|note:   template argument deduction/substitution failed:|
 main.cpp|23|required from here|
 \include\c++\4.7.1\bits\range_access.h|48|error: request for member 'begin' in '__cont', which is of non-class type 'int'|
 main.cpp|23|error: no matching function for call to 'end(int&)'|
 main.cpp|23|note: candidates are:|
 \include\c++\4.7.1\initializer_list|99|note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)|
 \include\c++\4.7.1\initializer_list|99|note:   template argument deduction/substitution failed:|
 main.cpp|23|note:   mismatched types 'std::initializer_list<_Tp>' and 'int'|
 \include\c++\4.7.1\bits\range_access.h|97|note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])|
 \include\c++\4.7.1\bits\range_access.h|97|note:   template argument deduction/substitution failed:|
 main.cpp|23|note:   mismatched types '_Tp [_Nm]' and 'int'|
 \include\c++\4.7.1\bits\range_access.h|78|note: template<class _Container> decltype (__cont.end()) std::end(const _Container&)|
 \include\c++\4.7.1\bits\range_access.h|78|note:   template argument deduction/substitution failed:|
 main.cpp|23|required from here|
 \include\c++\4.7.1\bits\range_access.h|78|error: request for member 'end' in '__cont', which is of non-class type 'const int'|
 \include\c++\4.7.1\bits\range_access.h|68|note: template<class _Container> decltype (__cont.end()) std::end(_Container&)|
 \include\c++\4.7.1\bits\range_access.h|68|note:   template argument deduction/substitution failed:|
 main.cpp|23|required from here|
 \include\c++\4.7.1\bits\range_access.h|68|error: request for member 'end' in '__cont', which is of non-class type 'int'|
 main.cpp|23|error: unable to deduce 'auto&' from '<expression error>'|
||=== Build finished: 14 errors, 4 warnings (0 minutes, 6 seconds) ===|

Ответы на вопрос(3)

Ваш ответ на вопрос