No, it has to be posix threads. Win32 threads don't work last time I checked, hence the need for the winpthreads library. Make sure that you have a command line option enabled for -pthread as well, to enable threading. To do that, go into your Build Options, Compiler Options, Other Options and add it in.
Ahh, it throws the same error as before, I have every setting like the picture you've shown me but it still doesn't work. I have windows, should I have chosen
Should work. You probably specified the wrong path or didn't choose the compiler for the project in build options.
Make sure that you have a command line option enabled for -pthread as well, to enable threading.
I didn't have to do this in my environment for some reason.
I'm getting errors for your fixed version, if I don't have #include <process.h>
I'll get
_beginthreadex() was not declared in this scope
if I have #include <process.h>
then I get these:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
mingw32-g++.exe -Wall -fexceptions -pthread -g -std=c++11 -Wextra -c "C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp" -o obj\Debug\main.o
C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp: In function 'bool isMerssenePrime(int)':
C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp:21:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp: In function 'int main()':
C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp:53:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp:63:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp:71:9: error: invalid conversion from 'unsigned int (*)(void*)' to 'unsigned int (__attribute__((__stdcall__)) *)(void*)' [-fpermissive]
In file included from C:\Users\cocon_000\Desktop\Daniel Pham's C++\PrimeArgsThreading\main.cpp:3:0:
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/process.h:100:2: error: initializing argument 3 of 'long unsigned int _beginthreadex(void*, unsigned int, unsigned int (__attribute__((__stdcall__)) *)(void*), void*, unsigned int, unsigned int*)' [-fpermissive]
Process terminated with status 1 (0 minute(s), 1 second(s))
2 error(s), 3 warning(s) (0 minute(s), 1 second(s))