Author Topic: How to get code containing pthreads to compile on Windows?  (Read 10844 times)

Offline c_weed

  • Single posting newcomer
  • *
  • Posts: 9
How to get code containing pthreads to compile on Windows?
« on: October 09, 2013, 11:26:27 am »
I've got some source code containing pthreads and want to build it and run it on Windows. I have mingw installed so I think I should be able to. I was getting errors when compiling through Codeblocks and I added "-pthread" under "other linker options" and it helped but I still get the error "mingw32-g++.exe: error: unrecognized option '-pthread'" and the program exits immediately. How can I fix this?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7787
    • My Best Post
Re: How to get code containing pthreads to compile on Windows?
« Reply #1 on: October 09, 2013, 03:25:40 pm »
I've got some source code containing pthreads and want to build it and run it on Windows. I have mingw installed so I think I should be able to. I was getting errors when compiling through Codeblocks and I added "-pthread" under "other linker options" and it helped but I still get the error "mingw32-g++.exe: error: unrecognized option '-pthread'" and the program exits immediately. How can I fix this?

Use a compiler that supports the option "-pthread".

You will likely need to change OS to do this.

Read the FAQs and Rules. http://forums.codeblocks.org/index.php/topic,9996.0.html

Make sure you read and understand these FAQs
http://wiki.codeblocks.org/index.php?title=FAQ-General#Q:_What_Code::Blocks_is_not.3F
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org