Linker error compiling mex with mingw-w64
I'm trying to setup Mingw-w64 as the mex compiler in MATLAB 2013a. My laptop has x86_64 architecture and runs windows 7. The program I want to compile uses c++11-style threading, so I'm using mingw-w64 version 4.9.0 with posix threads. According to instruction I found here and here , I modified my mexopts.bat file. The code seems to compile successfully, but the linker reports an error. Does anyone have suggestions what I might be doing wrong? By the way, I tried using gnumex to setup the compiler, but that didn't work either. Here's the output and error message that MATLAB gives: >mex -v