-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 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.

If I say that -pthread . But it seems that it does not seem right to do so.

Here is a short test program:

  #include & lt; pthread.h & gt; Int main (int argc, char ** argv) {pthread_mutex_t m; pthread_mutex_init (& amp; m, 0); Exit (0); }   

Sample compile:

  $ 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 $   

I can go with it: < Pre> $ X86_64-w64-mingw32-g ++ -mthreads x.cpp -pthread $

but it looks incorrect.

For people who are not familiar with - 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   

Any suggestions?

You are using pthreads, so use -pthreads -mthreads is something else.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -