Fixed compile and linking under mingw environment