I am currently trying to install Eclipse for making C++ programs.
I've run into an issue when compiling the premade default hello world program.
The console shows this error:
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
I am not using the library in my program at all.
Any ideas on how to fix this?
In the Windows search bar, type 'settings' to open your Windows Settings. Search for Edit environment variables for your account. Choose the Path variable in your User variables and then select Edit. Select New and add the Mingw-w64 destination folder path to the system path.
MinGW is a native C/C++ compiler(GCC) which have free distributable import libraries and header files for building native Windows applications. In this tutorial, we are going to install MinGW for C/C++.
The MinGW compiler is a well known and widely used software for installing GCC and G++ compilers for the C and C++ programming languages.
Just run and open MinGW Installation Manager, which should be pre-installed with MinGW, select "All Packages" on the left panel, and on the right panel, search for "mingw32-pthreads-w32" packages and install them.
Restart Eclipse, rebuild the project and run it. It should now work.
I had the same problem even with those packages installed. I had to go to mingw\lib and copy the file libpthreadGC-3.a and rename it to libpthread.a and the file libpthreadGC-3.dll.a rename it to libpthread.dll.a
After that it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With