我的编译器是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版本信息: