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?
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 also have cygwin installed ... see the question on mingw.org. I ended up with adding
'C:/cygwin/lib'
to the settings for the "Library search path (-L)" atproperties >> c/c++ build >> settings >> MinGW C Linker >> Libraries
.After installing MinGw mingw-gcc-g++, reopen Eclipse, then clear errors. Once all the errors are cleared, try rebuilding your project.