cannot run a program after gcc compiling in ubuntu 11.10, it works in previous version

Asked by shisteven

admin@ubuntu:~$ ./myprog
terminate called after throwing an instance of 'std::system_error'
  what(): Operation not permitted
Aborted

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
shisteven
Solved:
Last query:
Last reply:
Revision history for this message
shisteven (xiangjunshi) said :
#1

C++ code:

#include <iostream>
#include <thread>

void thFun1()
{
 std::cout << "Hi from thread!\n";
}

int main()
{
 std::thread th(&thFun1);
 std::cout << "Hi from main!\n";
 std::thread th1(std::move(th));
 th1.join();
 return 0;
}

Revision history for this message
shisteven (xiangjunshi) said :
#2

in ubuntu 11.04, "-lpthread" is filled in the field of Linker flags in eclipse CDT. it works. but same configuration cause above error in ubuntu 11.10.

in ubuntu 11.10, "-lpthread" is removed from the field of Linker flags. and add the library pthread in the field of Libraries in eclipse CDT. It wors now.

who can tell me the reason?