所以我试图用一个线程运行一个简单的 hello world 程序。它是用于向您介绍线程的标准 hello world 程序。我在 Ubuntu 14.04 上使用 Code::Blocks IDE,我有 gcc 4.8.2。我使用 GCC 编译器来构建我的项目,并且我还检查了选项“让 g++ 遵循 C++11 ISO C++ 语言标准 [-std=c++11]”,但是当我构建项目时,我得到了这个错误:
`terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted`
我已经看到了告诉我添加
-pthread
的解决方案和 -lthread
某处,但我不知道在哪里写这个......有什么帮助吗?
最佳答案
将“-pthread”添加到您的链接器选项(“链接器设置”→“其他链接器选项”)。
code blocks pthread
的第一个 Google 结果)关于multithreading - Ubuntu 14.04 中 Code::Blocks 上的 C++11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28364754/