Build error -lpthread

Asked

Viewed 244 times

0

I am trying to compile a file. c, but whenever I call gcc filename. c, I have the following error:

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
[Finished in 0.3s]

The file does not have any syntax error, or anything like.

What could be the problem?

1 answer

1


You are using the Mingw32 compiler that uses the Windows API (which has no reference to Posix Thread, vulga pthread).

To solve your build problem you must install Pthreads for Windows which will make them available in both Windows and the Mingw compiler.

Still if the installation path is different from the Mingw libs path you should reference by the command -L"Path/To/A/Lib/pthread" in the Linker parameters (Ld).

Answer based on question "Cannot find -lpthread?" of Stackoverflow in English.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.