Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse MinGW C++ cannot find -lpthread

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?

like image 391
Namr2000 Avatar asked Aug 27 '16 20:08

Namr2000


People also ask

How do I find my MinGW path?

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.

Can we use MinGW for C?

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++.

Is MinGW same for C and 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.


2 Answers

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.

like image 62
Kupar Buhroy Avatar answered Nov 03 '22 19:11

Kupar Buhroy


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!

like image 3
user7032279 Avatar answered Nov 03 '22 18:11

user7032279