Eclipse MinGW C ++ cannot find -lpthread

I am currently trying to install Eclipse to create C ++ programs.

I had a problem compiling a ready-made default default welcome program.

The console shows this error:

c: / mingw / bin /../ lib / gcc / mingw32 / 5.3.0 /../../../../ mingw32 / bin / ld.exe: cannot find -lpthread

I don’t use the library at all in my program.

Any ideas on how to fix this?

+7
c ++ gcc eclipse mingw
source share
4 answers

Just start and open the MinGW installation manager, which must be pre-installed using MinGW, select "All packages" in the left pane, and in the right pane, find " mingw32-pthreads-w32 " and install them.

Restart Eclipse, rebuild the project, and run it. Now it should work.

+6
source share

I had the same problem, even with installed packages. 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!

+2
source share

After installing MinGw mingw-gcc-g ++, re-run Eclipse and then clear the errors. After fixing all the errors, try restoring the project.

0
source share

If you also have cygwin installed ... see the question on mingw.org . I ended up adding 'C:/cygwin/lib' to the settings for the "library search path (-L)" in properties >> c/c++ build >> settings >> MinGW C Linker >> Libraries .

0
source share

All Articles