Including standard math.h header with both -O2 and -std=c++NN options results in compilation error due to a bug in the header, see MinGW bug report at https://sourceforge.net/p/mingw/bugs/2250/ Work around this to allow the library to compile in release build with -std=c++11. This is ugly but better than failing to compile at all.