Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 375
Shwnwil Avatar asked Oct 17 '25 15:10

Shwnwil


1 Answers

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.

like image 114
David Heffernan Avatar answered Oct 20 '25 05:10

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!