I'm going to assume that you already are using MinGW and MSYS. I'm probably silly for doing so, but oh well :)
You'll need the java runtime on your machine. You can get it here: The Java Download Page . You can download the right package for your platform (Windows?). Use the JDK if you are going to do some java coding, otherwise just get the JRE. I don't think you could use the java runtime that comes with windows, so you really need this. It comes as a nice installer, just like MinGW and MSYS. Be sure to allow the installer to add the 'bin' directory to your path. Bring up a MSYS window and type java -version to check that you are now using the right java. You can also check with which java. It should be in your system32, and as of this document should be version 1.4.2.
Pick this puppy up here: Eclipse Download Page . Right now version 2.1.1 is the latest official release. I wouldn't mess around with the 3.0 stuff yet.
To install eclipse you'll need to unzip and/or untar the file. There is no installer for this because it pretty much runs out-of-the-box. The key here to use with MinGW is that I ended up unzip/taring it into my 'home' directory. I did something like this: unzip /c/downloads/eclipse-SDK-2.1.1-win32.zip from my 'home' directory. If you are using a graphical zip tool, just unzip it into your c:/MSYS/home/username or equivalent directory. In the eclipse directory there should be a eclipse.exe file.
Here is the catch on using this; where ever you invoke the exe from, it will create a workspace directory where it stores it's projects. To kind of work around this I created a little script that I called ec that I put in my PATH. Here is what it looks like.
#!/bin/sh OLD=$PWD cd ~/eclipse eclipse.exe \& cd $OLD
This just makes sure that eclipse is always run in it's own directory, so we don't have 'workspace' directories crudding up all your directory structure. Don't worry, you can put your actual projects whereever you like.
Well, that's great! Eclipse is a great IDE for working on java, but we really want to get to using C++ (the TRUE programming language). So, all we need is C/C++ IDE plugin from the Eclipse Tools Project. You can get it here: CDT .
BEGIN PREACHING I would just like to take a moment and say what a great thing the new version 1.2 is. Wow, they really have got their act together. Anyone who uses this will find this out really quick. And I encourage anyone who agrees with me to help out the development effort. END PREACHING
So, anyhow, all the plugins for eclipse are just pretty much jar files that you put either in the plugins or the features subdirectories. In the case of the CDT however they seem to have put it in the same structure as the actual eclipse project. So, that means you should unzip it into the same directory as you did eclipse. If you are going by my example above that would be your home directory again.
The next time you run eclipse you'll be able to start creating C++ projects. As a matter of fact. I'll lead you right through it right now.
So, go ahead and start up eclipse right now. To create a project you'll go to File->New->Project....
This brings up a dialog for setting up your project.
If your dialog doesn't look like mine, with the C and C++ options, then your CDT is not installed right. There are two different options with the new 1.2 version, Standard Make C++ Project or Managed Make C++ Project. Select the one that you will need; if you want to maintain your own make file, then select Standard. If you want eclipse to maintain your make file, then select Managed. Since we are just going to do a simple example here, we'll use the managed project. CLICK 'Next >'.
This then bring you to the next screen where you enter your project name and location. Use whatever you like here. If you go with the default location the project will be placed in that workspace subdirectory that I've talked about.
CLICK 'Next >'.
You'll notice that eclipse has figured out that we are going to be using g++ (they think in cygwin). That's ok! Pick your platform and configurations. CLICK 'Next >'.
Go ahead and finish your project setup. You'll be prompted for a perspective switch. I go ahead and click the checkbox and then click 'Yes'. You should probably do so too.
Close the 'Welcome' view. Let's create a file. Right click on your project in the left hand project viewer. Select New->File
Name your file and click Finish
Once you click 'Finish' the file will be opened in the editor. Lets edit it and see what happens.
You'll notice that eclipse calls the makefile everytime one of your files is saved. Note this if you are going to maintain your own makefiles, be sure to have good dependancies setup so you don't recompile everything just because a file is saved. This is a leftover from being first a java IDE. Not a big deal if you have a well written makefile.
Ok, now for the fun stuff
Click on the the little 'Running Man' icon to bring up the Run dialog.
The first time that you do this for a project you'll have to set up what is to be run. Select C/C++ Local and click the 'New' Button.
You should have something that looks like this.
Click the Search... button and select the executable that you want to run.
Once you've done that and saved the changes you've made you'll be able to just click the little 'Running Man' whenever you like. You'll be able to see the output in the console.
Once you've set up your project to Run correctly it really easy to Debug it using gdb. Just click on the little Bug icon. You'll be taken to the debug perspective right away. Oh, I almost forgot, you might want to set a breakpoint by double clicking on the bar just to the left of the code before invoking the debugger.
ENJOY your experience with eclipse. Just so you know, the same project files that work on windows also work on Linux.
In this section I'll post any questions that come up.
I know Guurk is a silly name, but hey, I've played a lot of muds in my time. Contact me here: Guurk
I'm not going to pretend that I'm some sort of Guru with makefiles or something, as a matter of fact, far from it. However, there are a couple of little things that I like doing that someone else may find useful.
I like putting my source files in a subdirectory called 'src'. And likewise for the includes 'include'. My bins go in bin, and so on... Anyhow, because I don't like always adding a new file to my makefile every time I create one, here is how I get my files, thier header dependancies and the rules for them:
Here's how I set up my file lists.
Here's how I set up the rule
The SDL project uses a cool utility that also is used by libxml2 which allows for a makefile to figure out 'dynamically' which flags or libs to use for build with either of those libraries. All they are is a couple of shell scripts that give you at compile time the stuff you need.
When using them in your makefile you can do something like this:
You'll notice that I have config files for more than just sdl and libxml, I've made a couple for libxml++ and sigc++ as well. The real reason that I like doing this is that I can have specific versions of these files for each of the platforms that I want to build a project on and I don't have to have any platform specific makefiles or makefile logic to handle differences.
Here is what a file looks like, from there you can edit as you wish. Let me re-iterate, this was not my idea, it's not my code, and if you're the person who first did this, I'll put your name on it. I just think it's nifty.
Anyhow, drop me a line if you have some better ideas, or if you like mine.