Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Operation not permitted

 

Operation not permitted is a runtime error.

 

 

 

 

 

 

Full error message

 

terminate called after throwing an instance of 'std::system_error'
  what():  Operation not permitted

 

 

 

 

 

Code causing the error

 

#include <iostream>
#include <thread>

int main()
{
  std::thread t(
    []
    {
      std::cout<<"Hello world\n";
    }
  );
  t.join();
}

 

With Qt Creator project file:

 

TEMPLATE = app
CONFIG += console
CONFIG -= qt
QMAKE_CXXFLAGS += -std=c++11
SOURCES += main.cpp

 

 

 

 

 

Solution

 

Add the following line to the Qt Creator project file:

 

LIBS += -lpthread

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml