-mthreads on mingw 4.8.2 (on Fedora 20) now generating lihnking errors - should I use both -mthreads and -pthread? -
I've just advanced for the cross-compile project in Fedora 20. Fedora 8 is using 20 minzw 4.8.2-1.fc20 My code is mostly there, but I get many uncertain references to If I say that Here is a short test program: Sample compile: I can go with it: < Pre> but it looks incorrect. For people who are not familiar with Any suggestions? You are using pthreads, so use pthread_mutex_init and other pthread mutex functions to link. I am connecting with the
-mthreads option because my code is multi-threaded and uses exceptions.
-pthread . But it seems that it does not seem right to do so.
#include & lt; pthread.h & gt; Int main (int argc, char ** argv) {pthread_mutex_t m; pthread_mutex_init (& amp; m, 0); Exit (0); }
$ x86_64-w64-mingw32-g ++ -mthreads x.cpp /tmp/ccqTnLlg.o:x Cpp :( .text + 0x21): Undefined reference to the 'pthread_mutex_init' collection: 2: Error: ld 1 exit status $
$ X86_64-w64-mingw32-g ++ -mthreads x.cpp -pthread $
- Mthread is for , here is the section from the man page:
-Mthreads Support thread - Safe exception handling at MinGW Programs that rely on thread-safe exception handling, compile them and link all code with -themthreads option. When compiling, -the mathrades define "-D_MT"; While linking, it links to a special thread helper library-lmingwthrd that clears per-thread exception handling data
-pthreads
-mthreads is something else.
Comments
Post a Comment