Thread Module in c++11

C++11 supports Thread library ( If you are using it in your application you have to pass -pthread to g++ linker to inform it which sort of backend should be used for linking Thread library. If -pthread is not passed your application will end up with following execution error:

terminate called after throwing an instance of 'std::system_error'
 what(): Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)


Qt Creator was set to -std=gnu++0x

I was playing with c++11/14 in a project created using Qt Creator. I found that Qt creator is passing -std=gnu++0x to compiler whereas my .pro file was configured to use c++11.

My <qt_project>.pro file was having:

CONFIG += c++11

The fix for this problem was to force Qt creator to use specified c++ standard instead of using default one. This can be done by having strict_c++ keyword in .pro file.

CONFIG += strict_c++ c++11