关于线程的程序无法在我的代码:: blocks IDE中运行

时间:2014-09-03 04:42:41

标签: c++ multithreading c++11

我的编译器是GCC,并且我选择了编译器标志,以便它可以跟随C ++ 11。但是,当我编译我的程序涉及线程时,我得到错误的消息" D:\ C ++ YouTube \ Thread \ main.cpp | 12 |错误:'线程'未在此范围内宣布"。问题是什么???下面是我的代码:

 #include <iostream>
 #include <thread>


using namespace std;

void function_1() {
    cout << "Hello, here is a thread." << endl;
}

int main() {
    thread t1(function_1());

    return 0;
}

这是我的gcc版本信息:

enter image description here

0 个答案:

没有答案