When you try to connect the thread or mutex library, the compilation fails.
The error is in the functional library of the C ++ standard.
When it is connected, the program crashes.
The compiler complains about this code:

astatic_assert(_Varargs::value ? sizeof...(_BoundArgs) >= _Arity::value + 1 : sizeof...(_BoundArgs) == _Arity::value + 1, "Wrong number of arguments for pointer-to-member"); }; 

Previously, everything worked fine. Compiler - MinGW

  • The question is what code do you compile . Not just the way it falls - from one #include<thread> ? - Harry
  • In any project, even empty. - Alleksh _
  • Something is, to put it mildly, very strange. Those. this is ideone.com/Gpiu9I - is it not compiled? - Harry
  • @Harry, no, it does not compile: prntscr.com/jh0my2 - Alleksh _
  • Without thread everything is fine: prntscr.com/jh0npx - Alleksh _

2 answers 2

Pay attention to the C ++ standard which is specified in the compilation parameters. Because the compiler swears at ellipsis from the string sizeof...(_BoundArgs) . Such constructions with dots appeared only from C ++ 17 version; they are used for convolving template parameters. Since your compiler does not know about them, it seems that it supports the old versions of the standard.

GCC has a special key to indicate the version of the -std standard; for C ++ 17, you must specify -std=c++17 .

  • CONFIG + = c ++ 17 -std = c ++ 17 QMAKE_CXXFLAGS + = -std = c ++ 17 None of this works. Compiler - MinGW - Alleksh _
  • prntscr.com/jqkpdb Now, by the way, any application is not compiled. - Alleksh _

possible for the compiler is not a standard library, try to connect via

 #pragma comment( lib, "thread" ) 

or add in project properties. Did you change the version of the compiler?

  • Did not change, and did not update anything. Your way is not working. prntscr.com/jjjxah - Alleksh _
  • Try #include <pthread.h> - Ilya Rogatkin
  • And tried to add to the project? - Ilya Rogatkin
  • #include <pthread.h> does not work. How can I add a library to a project? - Alleksh _
  • And there’s no point in adding minGW from the compiler. something in functional is broken. - Alleksh _