ApCoCoA-1:HowTo:Tips for developing (Ap)CoCoA with Eclipse
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,
- install the Mercurial plug-in (Help > Software Updates > Available Software > Add site... : http://www.vectrace.com/eclipse-update/)
- Create a new project with the Mercurial "Clone..." wizard.
- Convert the newly cloned project to a C / C++ Project
- Add the
include
directories from CoCoALib and ApCoCoALib. - 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 subclipse
Help > Software Updates ... >
Tab Available Software> Add Site...
- Set Location http://subclipse.tigris.org/update_1.4.x
- Select at least 'Subclipse'
- Install, accept license, restart platform...
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
- Open the Navigator view (
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
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.