0

I was using thread on my netbeans ide 16 and it was giving error(main.cpp:14:4: error: 'thread' was not declared in this scope)

i tried adding -pthread and -lpthread in additional options but it didnt work.enter image description here

  • 1
    Never `#include ` [https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h) – drescherjm Dec 26 '22 at 19:51
  • Using pthreads are not std::thread – drescherjm Dec 26 '22 at 19:52
  • Welcome to StackOverflow! If you really want help with your problem you should take the [*tour of StackOverflow*](https://stackoverflow.com/tour) and check out [*How do I ask a good question?*](https://stackoverflow.com/help/how-to-ask) then check out [*Why should I not upload images of code/data/errors?*](https://meta.stackoverflow.com/q/285551/845568) and [*creating a minimal,reproducable example*](https://stackoverflow.com/help/minimal-reproducible-example). – Captain Obvlious Dec 26 '22 at 19:53
  • You should have `#include ` [https://en.cppreference.com/w/cpp/thread/thread](https://en.cppreference.com/w/cpp/thread/thread) and if that does not work your compiler is very old but maybe it still has support for the 2011 standard: [https://stackoverflow.com/questions/10363646/compiling-c11-with-g](https://stackoverflow.com/questions/10363646/compiling-c11-with-g) – drescherjm Dec 26 '22 at 19:53
  • 1
    My guess would be you're using an old version of mingw with no std::thread support – Alan Birtles Dec 26 '22 at 22:18
  • I expect the same. Using this: [https://www.msys2.org/#installation](https://www.msys2.org/#installation) will install the most current version of MinGW. – drescherjm Dec 27 '22 at 14:59

0 Answers0