14 May

-mthreads, -mthreads, -mthreads…

This falls in the obvious category but I’m posting this just that someone will see this even by accident: always use -mthreads when using threads under MinGW. I repeat (so that I remember this in future): always use -mthreads when using threads under MinGW. I just spent hours using gdb instead of -mthreads.

I.e.:

g++ -mthreads -o game.exe game.c

The mentioned option makes MinGW use thread-safe stuff internally. It is not enough a library claims to be thread-safe (well, actually it probably claims to be thread-safe as long as the runtime providing malloc et al is safe, which indeed is not the case when not using -mthreads).

At least Viewer2 is fast now.

Leave a Reply

Your email address will not be published. Required fields are marked *