Search code examples
ccompiler-constructionpthreads-win32

How to run Pthreads on windows


I used to use a mac to write some C programs but it's not working now.
I have to use an old windows laptop for a while.

I installed codeblocks and tested a simple program using Pthreads. Unfortunately it didn't work.

  pthread_create(&thrd1, NULL, thread_execute, (void *)t);

It keeps saying undefined reference to _imp__pthread_create

How can i fix it?


Solution

  • You've clearly got a version of pthreads for Windows. You just haven't included the .lib file in your linker settings. Do that and you should be golden.