小编A. *_*pez的帖子

对pthread CLion的未定义引用

我正在尝试在CLion中运行这个简单的线程c ++程序

#include <iostream>
#include <thread>

using namespace std;


//Start of the thread t1
 void hello() {
     cout << "Hello,concurrent world!" << endl; }



 int main() {
     thread t1(hello);     // spawn new thread that calls hello()

     cout << "Concurrency has started!" << endl;
     t1.join();            

     cout << "Concurrency completed!";

     return 0;
   }
Run Code Online (Sandbox Code Playgroud)

我的问题是有一个未定义的引用pthread的错误,我没有看出我做错了什么...请注意我在CLion上这样做.

c++ pthreads c++11 clion

6
推荐指数
3
解决办法
9924
查看次数

标签 统计

c++ ×1

c++11 ×1

clion ×1

pthreads ×1