A rather dull worKLOG. This is just a scratchpad for solutions to IT problems that might be useful to someone else. Expect no opinions, no brilliant insights and definitely no pictures of pets or children. Expect stack traces, code snippets and other hints for the Google Indexer.

Tuesday, November 07, 2006

Setting up C++ in Eclipse on Windows

Although Eclipse works most naturally as a Java IDE, it doesn't do too
badly for other languages, and has the advantage that you don't need to
learn multiple IDEs and can keep all your code together in a single
environment.
Steps in setting up C++ in Eclipse, on Windows:
* If it's not already installed, get the CDT plugin - this is available
as part of the standard Callisto bundle from the Eclipse website.
(help/software updates/find and install/add new remote site
http://download.eclipse.org/tools/cdt/releases/callisto)
* The CDT doesn't come with its own compilers etc - you'll need to
download them separately. One option is to install Cygwin, making sure
that you're ticked all the boxes to get make and gcc. Important: don't
forget to add cygwin/bin to your windows path. The problem is, that any
executables you then make will need the cygwin1.dll to be bundled with
them, which is hardly ideal.
* An alternative, mentioned in
http://wiki.fredlackey.com/pmwiki.php?n=HelpfulInfo.DevelopmentEclipseCppCofnig
and others is to install MinGW from
http://prdownloads.sourceforge.net/mingw/MinGW-5.0.3.exe?download which
will produce exes with no dependencies. Again, make sure it's on your path.
* Managed vs Standard projects. If you create a managed project then
Eclipse will generate a simple makefile for you, otherwise you are
expected to create a makefile yourself, and will spend many happy hours
hitting the "build" button and wondering why nothing happens.