ApCoCoA-1:HowTo:Tips for developing (Ap)CoCoA with Eclipse

From ApCoCoAWiki
Revision as of 08:35, 29 October 2020 by Andraschko (talk | contribs) (Andraschko moved page HowTo:Tips for developing (Ap)CoCoA with Eclipse to ApCoCoA-1:HowTo:Tips for developing (Ap)CoCoA with Eclipse: not relevant for ApCoCoA-2 (probably outdated long ago))

Building (Ap)CoCoALib in Eclipse

  • Get Eclipse with the Eclipse C/C++ Development plug-in's (e.g. download from http://www.eclipse.org/downloads/)
  • Uncheck Project > Build automatically, otherwise, every time you save a modified file your project is rebuilt.
  • Get (http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html) and unzip CoCoALib in your workspace. (You should currently rename the folder CoCoALib-0.99xx to CoCoALib-0.99)
  • Create a new C++ project (e.g., File > New > C++ Project >Makefile Project > Empty Project)
  • Add the include directory to the C++ Include directories (Project > Properties > C/C++ General > Paths and Symbols)
  • Run ./configure, either from the console or with the following Ant code:


<?xml version="1.0"?>
<project name="Demo" basedir="." default="configure">
 <property name="root.dir" value="." />
 <path id="classpath">
   <pathelement location="." />
 </path>
 <target name="configure">
   <exec executable="./configure" dir="${root.dir}">
     <!-- Only needed for ApCoCoA: -->
     <arg value="--with-libconfig=lib.config" />
   </exec>
 </target>
</project>


If Eclipse calls make all before it starts configure, right-click build.xml and uncheck "Build before launch" under "Run As > External Tools Configuration... > Build".

  • Now build the CoCoALib project
  • To build ApCoCoALib, follow the same steps as above. To get the latest sources from the Mercurial repository,
  1. install the Mercurial plug-in (Help > Software Updates > Available Software > Add site... : http://www.vectrace.com/eclipse-update/)
  2. Create a new project with the Mercurial "Clone..." wizard.
  3. Convert the newly cloned project to a C / C++ Project
  4. Add the include directories from CoCoALib and ApCoCoALib.
  5. Run configure and build the project as above.

Code completion troubleshooting

Code completion does not work and my editor window has a gray background

In this case it could be that you are currently working within a #ifdef SOME_SYMBOL block and the symbol SOME_SYMBOL has not been declared within your Eclipse project. Symbols can be declared by clicking on Project -> Properties -> C/C++ General -> Paths and Symbols -> Symbols. Be sure to declare the symbol for the correct programming language (e.g. "GNU C++"). ==General search and completion issues

  • Make sure to have a CoCoALib project in addition to your ApCoCoA project and set

Accessing the subversion repository from Eclipse

Step 1: Install subversive

(As for 2012-06-14, Eclipse Indigo)

  • Help > Install New Software
  • Select to Work with the Eclipse download site (currently Indigo)
  • Under Collaboration you will find the Subversive Team Provider
  • Install, accept license, restart platform...
  • When you use the plugin for the first time, you will be ask to install a connector plug-in. Select at least the latest SVNKit.


(As for 2009-06-10, Eclipse Ganymede SR2)

Step 2: Set up

  • File > New...
  • In the wizard selector, select 'Checkout Projects from SVN'
  • Next, select Create a new repository location
  • The Url for the ApCoCoALib is svn://apcocoa.org/ApCoCoALib, the Url for ApCoCoAPackages is svn://apcocoa.org/ApCoCoAPackages
  • Select trunk, Next
  • Select Check out as a project configured using the New Project Wizard. This gives you the opportunity to select a C++ project type for the ApCoCoALib and the "standard project type" for the ApCoCoAPackages. Moreover, in most cases, you simply want to check out the HEAD revision. Finish.
  • Select the appropriate project type and name the project
  • If the project is created, exclude the files .project and .cproject from version control:
    • Open the Navigator view (Window > Show View > Navigator
    • Right click on the respective files > Team > Add to svn:ignore

Step 3: Edit your sources and commit your work

  • Edit...
  • Right click on the edited resources or folders containing them or the project root > Team > Commit...
  • ... 'to be completed'

Mercurial plugin troubleshooting

Please note that the ApCoCoA Mercurial repositories will no longer be maintained. The sources are now kept in a Subversion repository; see also #Accessing the subversion repository from Eclipse.

Linux specific problems

In at least one case, it was not possible to push changes into a repository if Eclipse had not been started from a shell. The reason for this was that the password entered into the password form of the Eclipse Mercurial plugin was ignored and had to been entered manually in the shell instead. It might be worth noting that the password entered in Eclipse was shown in clear text in the shell as well.

Push fails

There are several (unconfirmed) reasons why this might happen.

  • Using a ssh connection: Eclipse has not been started from a shell under Linux. Please see section above. (?)
  • Wrong path to repository. In this case the Eclipse error message is very precise.