# Eclipse CDT with MinGW 64

Let's say you have a Windows PC on a 64 bit machine. Obviously, you have Cygwin because anything else would just be silly. Then you want to develop C-Applications that you can compile and run on large Linux-based servers, so you turn to an an IDE that can work with Cygwin. Now here comes the twist: For whatever stubborn reason, you want to be able to compile your applications native 64 bit, and you want to do it in Eclipse, and you want to be able to debug them. It's been a while that I blagged about GMP with MinGW-64. Thanks to a very enlightening stackoverflow answer, I could catch a glimpse of how to use ./configure in a less crude way1. There's a quite comprehensible document on configure parameters which basically tells you everything you need to know. In fact, compiling GDB under cygwin using
./configure \
--build=i686-pc-cygwin    \
--host=x86_64-w64-mingw32 \
--prefix=/usr/x86_64-w64-mingw32/sys-root/mingw
make
make check
make install

will actually install GDB in such a way that
x86_64-w64-mingw32-gcc -o testfile testfile.c

now simply works! Note that with my previous approach, the make install would not work properly (for it did not know about /usr/x86_64-w64-mingw32/sys-root/mingw, of course). That made me think ‐ why don't I just setup eclipse to use x86_64-w64-mingw32-gcc? Like this:

(remember to also change the linker and assembler executable)
Well, the problem is, there doesn't yet seem to be a GDB coming with the x86_64-w64-mingw32-gcc. However, now that we know how to compile and install stuff, this is easy:
wget http://ftp.gnu.org/gnu/gdb/gdb-7.5.tar.gz
tar -xzf gdb-7.5.tar.gz
cd gdb-7.5/
./configure \
--build=i686-pc-cygwin    \
--host=x86_64-w64-mingw32 \
--prefix=/usr/x86_64-w64-mingw32/sys-root/mingw
make
make check
make install

And after that is done, set up eclipse to use the new gdb:
And voilà! You can now compile and debug C applications in Eclipse in native 64 bit. In particular, debugging no longer suffers from the problems caused by 32 bit applications being virtualized.
1. Also, I now know that you have to add /usr/x86_64-w64-mingw32/sys-root/mingw/bin to your PATH in order to use OpenMP with MinGW 64. []