0

I've compiled this websocket++ print server example, executed it, and confirmed it worked by testing on my server and a browser.

Now, I've compiled this websocket++ broadcast server example with the command g++ -O3 -o bServer broadcast_server.cpp -I ~/websocketpp-experimental/ -std=c++0x -D_WEBSOCKETPP_CPP11_STL_ -D_WEBSOCKETPP_NO_CPP11_REGEX_ -lboost_regex -lboost_system according to the author's recommendations.

./bServer gives Operation not permitted.

ls -l bServer gives -rwxr-xr-x 1 root root 574151 Jun 29 22:31 bServer which as far as I know indicates that it's permitted to be executed.

How can I execute this program?

Community
  • 1
  • 1

2 Answers2

2

Your program is printing this message. Find where it is printed and print more information.

brian beuning
  • 2,836
  • 18
  • 22
1

brian got to the heart of the matter, and here's the total solution:

In the broadcast_server.cpp example, there's

        try {
            m_server.run();
        } catch (const std::exception & e) {
            std::cout << e.what() << std::endl;
        } catch (websocketpp::lib::error_code e) {
            std::cout << e.message() << std::endl;
        } catch (...) {
            std::cout << "other exception" << std::endl;
        }

Googling std "Operation not permitted" autocompletes to std thread operation not permitted, and the first result is this question: C++0x: thread, gcc or my error?

Using the -pthread flag fixes it.

Community
  • 1
  • 1