Eclipse + CDT + MinGW + XP x64

I’ve previously complained about the lack of decent free IDEs for developing C++, and since it’s been a while, I gave Eclipse another shot. The good news: CDT 4 no longer crashes every 5 minutes, it has much better project structure, and I think I can work with this. The bad news: It took ages to get everything up and running with MinGW.

The following is an attempt to remember what the problems were.

Problem #1: Eclipse isn’t updating
The first problem I had was that Eclipse refused to install any updates. This threw me off for about a week, until I found a solution.

Problem #2: Running MSYS on x64
MSYS is the minimal POSIX system for windows, and it gives you a shell and some other stuff that’s good to have. Alas, the shell doesn’t stay open for long on x64.
C:\msys\1.0\bin\rxvt.exe: *** fork: can’t reserve memory for stack 0x480000 – 0x680000, Win32 error 0
0 [main] rxvt 2928 sync_with_child: child 1440(0x2CC) died before initialization with status code 0x1
43 [main] rxvt 2928 sync_with_child: *** child state waiting for longjmp
rxvt: can’t fork
rxvt: aborting
Some googling produced this page. Basically, you need to run msys.bat in a 32-bit environment, because the MinGW people are a bit slow with their x64 support.

Problem #3: Recompiling luabind
Because luabind is a C++ library, it’s not compatible with the Visual C++ libraries I already had. Just to be on the safe side, I decided to recompile all my 3rd-party libraries. This worked fine for lua and libxml with the provided makefiles, but luabind + MinGW was a bummer. Apart from needing the latest revision from SVN (r507), I also had to hack object.hpp as described in this post.

Problem #4: my lua bindings won’t compile
iterator_policy.hpp:22: error: no match for ‘operator!=’
This was relatively easy. If you write your own iterators (for example, to walk through your own linked list type) then define an operator!=. On Visual C++ and plain old gcc it was enough to have an operator==, but somehow the gcc in MinGW seems to be more picky.

Problem #5: my output ends up in the eclipse console!
At this point, after a lot of config-tweaking because the mingw gcc didn’t have execinfo.h and a bunch of other POSIX stuff, I get the program to run. And input/output ends up in the Eclipse console! I have no idea how to turn this off.
The Eressea server has an editing component that uses curses, and of course that won’t without a proper tty.
Status: unsolved

Problem #6: gdb crashes
Error: dll starting at 0x77d41000 not found.
Being a careful type I didn’t install any technology previews, just official releases. It turns out, though, that gdb 5.x is broken in an x64 environment. This is fixed by getting the latest technology preview.

At this point, I now have my code running under gdb in eclipse. It’s not awesome-like the way debugging in Visual Studio is. And it’s not as simple as plain gdb under linux, because the console in eclipse is shite. And gdb hung itself the first time around, though it didn’t take down eclipse when it did, so it could have been worse. This is going to take some getting used to.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.