Compilation error -lpthread

0

I'm trying to compile a .c file, but whenever I call gcc filename.c, I get 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 has no syntax error, or anything like that.

What can be the problem?

    
asked by anonymous 01.09.2016 / 18:26

1 answer

1

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

To solve your build problem you should install PThreads for Windows , which will make them available both in Windows and in the MinGW compiler.

Even if the installation path is different from the MinGW libs path, you should reference the Path / To / A / Lib / pthread command in the linker (ld) parameters.

Answer based on StackOverflow's " Can not find -lpthread? >     

01.09.2016 / 18:36