<?xml version='1.0' encoding='UTF-8'?>
<webpage id="eclipse-200810">
  <config param="rcsdate" value="$Date: 2009-04-23 22:08:29 +0200 (Thu, 23 Apr 2009) $"/>
  <head>
    <title>
      Eclipse Locally &amp; Vim Remotely
    </title>
    <summary>
      On Eclipse; for sophomore students in Computer 
			Science at VUB.
    </summary>
    <keywords>
      VUB, Belgium, Computer Science, Eclipse, C++,
      Object-oriented, Modeling, OO, CDT
    </keywords>
  </head>
	<section id='overview'>
	<title>Overview</title>
  <para>
	  If you <emphasis>don't hate</emphasis> <acronym>IDE</acronym>s, then you 
		owe yourself a look at
    <ulink url="http://en.wikipedia.org/wiki/Eclipse_(software)" 
		xreflabel="Eclipse IDE on Wikipedia, the Free Encyclopedia"><emphasis 
		role='bold'>Eclipse</emphasis></ulink>.
		I won't get involved in the editor wars --if you don't know, don't ask. 
		But I think Eclipse	is, among other things, a feature-rich C++ platform 
		offering features like incremental compilation, continious build, 
		easy-to-use <olink targetdoc='eclipse-200810' 
		targetptr='debug'>debugger</olink> and so on.
	</para>
	<para>
		I've decided to use it as my <emphasis>local</emphasis> development 
		environment next to <emphasis	role='bold'>Vim</emphasis> &amp; <emphasis 
		role='bold'>Make</emphasis> that I'll be using while working on the server 
		<emphasis>remotely</emphasis>.
	</para>

  <itemizedlist id='minitoc'><para>This guide is split into two parts:</para>
		<listitem>
		  <para><olink targetdoc='eclipse-200810' targetptr='install'>Part 
			I</olink>: describes the installation process; and</para></listitem>
		<listitem>
		  <para><olink targetdoc='eclipse-200810' targetptr='usage'>Part 
			II</olink>: briefly covers usage.</para></listitem></itemizedlist>
  <para>Happy Hacking!</para>
	</section>

  <section id='install'>
    <title>Download &amp; Install</title>
    <para>Eclipse Downloads are available at: 
    <ulink url="http://www.eclipse.org/downloads/"/></para>
    <para>
    It would be interesting to download the <emphasis role='bold'>Eclipse 
    Modeling Tools</emphasis> distribution, which
    already includes the plugins we <emphasis>might</emphasis> need for 
    experimenting with the UML editor. 
    </para>
    <para>
    Select your operating system and platform to proceed with the download.
    </para>
    <mediaobject>
      <imageobject>
        <imagedata fileref="eclipse-download-uml.png" format="PNG"/>
      </imageobject>
      <textobject>
        <phrase>Screenshot: Eclipse Modeling Tools distribution</phrase>
      </textobject>
    </mediaobject>
    <para>
    Install Eclipse by extracting the archive you just downloaded. GNU/Linux 
    users can install it under <filename class='directory'>/opt</filename>.
    </para>
    <screen>
    $ cd /opt
    $ sudo tar zxvf eclipse-modeling-...-linux-gtk.tar.gz
    </screen>
    <para>
      Try to create a shortcut depending on your graphical environment for 
      easier launch of Eclipse in the future.
    </para>
    <para>
      Once you launch Eclipse, you'll be prompted to choose a workspace. This
      is where your project files are stored. Something like 
      <filename class='directory'>~/ws/eclipse</filename> would be 
      appropriate.
    </para>
    <para>
      By installing new plugins we can adapt Eclipse to include 
      new functionalities we need. Here we're going to add the required 
      plugins for setting up a C/C++ IDE.
    </para>
    <section id='cdt'>
      <title>Installing CDT: the Eclipse C/C++ Subproject</title>
      <para>
        Go to: <emphasis role='bold'>Help &gt; Software</emphasis>
      </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-help-updates.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: Where to install new plugins</phrase>
        </textobject>
      </mediaobject>
      <para>
        When the wisard shows up, go to	<guibutton>Install 
	Software</guibutton> tab and then click 
	on <guibutton>Add Site...</guibutton>. Enter the following
	<acronym>URL</acronym> in the input field.
	<screen>
	<userinput>http://download.eclipse.org/tools/cdt/releases/ganymede
	</userinput></screen>
      </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-add-cdt-releases.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: Add CDT Repository</phrase>
        </textobject>
      </mediaobject>
      <para>
        You have just added a new repository, which Eclipse can use to retrieve
	new plugins and their future updates. Now, check the button beside 
	the newly added repository and click on
	<guibutton>Install...</guibutton>.
      </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-install-cdt-components.png" 
	  format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: Select and Install CDT Components</phrase>
        </textobject>
      </mediaobject>
      <para>Proceed to install the selected plugins by following the steps 
      suggested by the wisard and then finish the installation.</para>
    </section>
  </section>
  <section id='usage'>
    <title>Usage</title>
    <para>Start a new C++ project by clicking on 
      <emphasis role='bold'>File &gt; New &gt; C++ Project</emphasis></para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-new-cpp-project.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: Start a New C++ Project</phrase>
        </textobject>
      </mediaobject>
    <para>
     When the wisard appears, make sure that you select the right environment.
    </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-new-cpp-project-wisard.png" 
	  format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: New C++ Project Wisard</phrase>
        </textobject>
      </mediaobject>
     <note id='convert-version-control'>
       <para>
         In case you're using a version control system, you should first check
         out your source code and while the focus is on the project in the 
	 file browser, click on <emphasis role='bold'>File &gt; New &gt; 
         Convert to a C/C++ Make Project</emphasis>.
        </para>
      </note>
      <para>
        Once the project is created, you should add your source files to
	the project. That is, <filename class='headerfile'>*.h</filename>
	files, <filename>*.C</filename>, Makefile, etc.
      </para>
    <section id='build'>
      <title>Build Your Project</title>
      <para>CDT perfectly understands <filename>Makefile</filename>s and you
      should be able to build your project without any adaptations as the
      default targets are called. You could however right-click on your
      project and then on <guibutton>Properties</guibutton> to check the
      build settings of your project.
      </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-build-config.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: C++ Project Build Settings</phrase>
        </textobject>
      </mediaobject>
    </section>
    <section id='run'>
      <title>Run Your Project</title>
      <para>
        In order to run an executable that has been generated by the compiler,
	right-click on the executable and then click on 
	<guibutton>Run As</guibutton> followed by <guibutton>Run 
	Configurations...</guibutton>.
      </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-run-config.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: C++ Project Run Configuration</phrase>
        </textobject>
      </mediaobject>
      <para>
        Now, right-click on <guibutton>C/C++ Local Application</guibutton>
	and the on <guibutton>New</guibutton>.
      </para>
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-run-new-config.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: C++ Project New Run Configuration</phrase>
        </textobject>
      </mediaobject>
      Your run settings might look like the following screenshot.
      <mediaobject>
        <imageobject>
          <imagedata fileref="eclipse-cpp-project-run-settings.png" 
	  format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Screenshot: C++ Project Run Settings</phrase>
        </textobject>
      </mediaobject>
    </section>
    <section id='debug'>
      <title>Debug Your Project</title>
      <para>Eclipse provides an excellent environment for debugging. It uses
      the magnificant <acronym>GDB</acronym> but the power is due to the 
      fact that it provides the developer with <emphasis role='bold'>visual 
      control</emphasis> over the code 
      and the evolution of variables.
      </para>
      <para>If the you're able to run your project, you could start debugging
      as easily as clicking on the <guibutton>Debug</guibutton> button.
      </para>
      <para>
        <ulink url="eclipse-cpp-debug-1280x800.png">
          <inlinemediaobject>
            <imageobject>
              <imagedata fileref="eclipse-cpp-debug.png" format="PNG"/>
            </imageobject>
            <textobject>
              <phrase>Screenshot: C++ Projet Debugger</phrase>
            </textobject>
          </inlinemediaobject>
        </ulink>
      </para>
    </section>
  </section>
	<sidebar id='audience'>
	  <title>Intended Audience</title>
    <para>
      This document is specifically written for sophomore	students in Computer 
		  Science at VUB.
    </para>
	</sidebar>
  <sidebar id='stub'>
    <title>Suggestions</title>
    <para>I look forward to your
    <olink targetdoc="contact">comments and 
    suggestions</olink>. If you wished this document
    were in a wiki, for instance, please feel free to 
    nod.
    </para>
  </sidebar>
  <sidebar id='platform'>
    <title>Platform</title>
    <para>
      Computing platform on which the instructions in this document are tested:
    </para>
    <formalpara><title>OS</title><para>GNU/Linux (Ubuntu Hardy)</para></formalpara>
    <formalpara><title>Eclipse</title><para>3.4.1</para></formalpara>
    <formalpara><title>Linux</title><para>2.6.24-21</para></formalpara>
    <formalpara><title>Machine Hardware</title><para>i686</para></formalpara>
  </sidebar>
  <sidebar id='svn'>
    <title>Version Control</title>
    <para>
      By using a version control system, you can easily maintain an up-to-date
      version of your code on the remote server provided by the university.
      I use <ulink xreflabel="Subversion (software)" 
      url="http://en.wikipedia.org/wiki/Subversion_(software)">Subversion</ulink>, which works quite well with Eclipse but other systems could also be used.</para>
      <para>Note that, if you don't care about keeping your code under a 
      version control system, you can still sync your code with the server
      by using <command>rsync</command>.
      </para>
  </sidebar>
</webpage>

