| How to setup Eclipse as a C++ IDE |
|
|
|
| Written by Administrator | |
| Friday, 07 July 2006 | |
|
So, you have Microsoft VisualC++, but you want to compile a open source project that is in a Subversion repository without having to dick around with Microsofts tools each time there is an update? The easiest way is to install a modern IDE (thats a integrated development environment) that can use subversion. There are a couple out there, and one of the most popular is Eclipse. Eclipse is known as a Java IDE, but has a subproject called the CDT which when combined with a GNU toolchain gives you a pretty nice development enviroment. So this is some quick notes on getting Eclipse and the CDT installed and running. There are two ways to get a toolchain for Eclipse, either MinGW or Cygwin. I prefer to use Cygwin for a number of reasons, and the install is very simple, and easy to update. So, lets install the compilers and libraries. Go to the Cygwin homepage and download the installer, setup.exe. Run the installer, select "install from the internet" and then the location for the install. Be warned: In certain situations, you can get into trouble if you have the cygwin folder inside other folders that contain a space in their names, for example "My documents", therefore C:\cygwin is the safest place. Also, make sure you leave the text type option as Unix or you are entering a world of pain. Next chose anywhere for the install package directory, then local connection unless you have a proxy, and then chose a mirror. I have found a couple of mirrors have been out of date, a safe one is the trusty ftp.sunet.se. Next up, you have to choose the packages you need to install. The user interface is a bit odd, so take some time to make sense of it before you start clicking! And make sure the radio button is on Curr (for current). Click on the icon on the left of Devel to open up the tree and see the available packages. If you click on the icon on the left of each package, you can see that you can either skip installing the package, or you get a version number, which means that version will be installed. So what packages do you need? Cygwin by default selects a collection of packages just to get you up and running, as we need a toolchain we will need to select some additional packages by. The least you will need is the compilers, library, and make. I have: autoconf Select what you need, click next, and all the packages will be downloaded and installed. If you need to add another package later, just run the installer as before, and chose the additional packages. Now we need to add the directory containing the tools we just installed, to your PC's PATH variable so it can find them. Open the Windows control panel, “system”. Click on the advanced tab, then the button “Environment Variables”. Then in the “Systems variables” section scroll down to “Path”. If you don't have one called Path, click on “new” and add one, else click on “edit” and add a semi-colon followed by your new path "C:\cygwin\bin" To check everything is working, open a NEW dos shell, and type: gcc --version If it runs, congratulations, you have a C++ compiler. Now for the IDE. Usually you would want to run the most stable version of Eclipse, however you really want the latest version of the CDT, so lets get the latest version of the IDE. Before you start, you need a Java SDK. Yes I know you are not compiling Java, but Eclipse is a Java application. Go to the Sun website and download the Java 2 standard Edition SDK, better known as the J2SE SDK from http://java.sun.com/javase/downloads/index.jsp. Remember, you don't want the Runtime version (JRE), but the SDK, currently JDK 5 update 7. Don't get the version with the bundled netbeans, unless you have more HD space than sense:) After you have installed Java, lets get Eclipse. The latest and greatest version of Eclipse is called Callisto. You can get the binary from http://www.eclipse.org/callisto/c-dev.php, click on "The Eclipse Platform Runtime Binaries" and download eclipse-platform-3.2-win32.zip. What no installer? Yep that gives you a 33MB zip file you need to decompress and then put the eclipse folder somewhere safe - into your "Program Files" directory would be ideal. Next run the eclipse.exe in that directory. When has started, chose the update menu "Find and Install" Make sure "Search for new features to install" is selected and click the next button. You now need to add the location of the CDT project. Choose "New Remote Site..." and then type a name of your choice and the URL to the CDT: http://download.eclipse.org/tools/cdt/releases/callisto Then click finish. In the next window choose a mirror, then in the next window open up the CDT tree to see what options can be selected. Choose just the Development tools, not the Tooling SDK. Click next, agree to the license, and then click the button "finish". When the install has finished, let it restart the Workbench. Now lets test our toolchain! Click on the menu "File", then "New" then "Managed Make C++ Project". In the project dialog window, give the project any name. Next right click the project folder, and choose "New", then "Source File". Call the file helloWorld.cpp and then paste the following into the file: // a small C++ program |
|
| Last Updated ( Friday, 07 July 2006 ) |










