Difference between revisions of "Eclipse"
(→Install a SVN package if you wish to upate your repository from inside Eclipse: (new)) |
(→Other useful packages depending on your task: (new)) |
||
Line 62: | Line 62: | ||
* '''Subclipse''' works fine for the downstream (<tt>svn checkout</tt>; <tt>svn update</tt>; ...), but I didn't find the way to commit. | * '''Subclipse''' works fine for the downstream (<tt>svn checkout</tt>; <tt>svn update</tt>; ...), but I didn't find the way to commit. | ||
* '''Subversive''' with the '''SVNKit''' backend works in both directions. In the ''User Credentials'' dialog leave the ''General'' tab (user name; pass''word'') blank and fill the "SSH Settings" tab (file; pass''phrase''). For some reasons if you access svn.gnucash.org often a dialog containing the general tab appears. Leave it empty, else you would lock your svn access. | * '''Subversive''' with the '''SVNKit''' backend works in both directions. In the ''User Credentials'' dialog leave the ''General'' tab (user name; pass''word'') blank and fill the "SSH Settings" tab (file; pass''phrase''). For some reasons if you access svn.gnucash.org often a dialog containing the general tab appears. Leave it empty, else you would lock your svn access. | ||
+ | |||
+ | === Other useful packages depending on your task === | ||
+ | |||
+ | * '''Linux Tools''' has a bunch of useful tools - if you are on Linux. | ||
+ | * There are several '''XML editors and tools''' if you wish to work on the ''documentation'' or ''account chart templates''. | ||
+ | * If you favor '''GIT''' over SVN, there are also several tools. | ||
= Working with Eclipse on GnuCash = | = Working with Eclipse on GnuCash = |
Revision as of 12:18, 5 August 2012
Eclipse C/C++ Development Tooling (CDT) can be used as a multi-feature editor and debugger for gnucash. Eclipse is a Java IDE but has a C/C++ project which has become quite mature. See www.eclipse.org/cdt/
Contents
- 1 Getting the Software
- 1.1 An Eclipse Package
- 1.2 Required Plugins
- 1.2.1 Add Plugin and Development Tool Software Sites in Eclipse
- 1.2.2 Install C/C++ if not already part of your package
- 1.2.3 Install Schemeway if you wish to work on Guile (Reports etc.)
- 1.2.4 Install a SVN package if you wish to upate your repository from inside Eclipse
- 1.2.5 Other useful packages depending on your task
- 2 Working with Eclipse on GnuCash
- 3 Getting eclipse 3.x to work with gnucash
- 4 Edit
- 5 Build (not to build)
- 6 Debug
Getting the Software
An Eclipse Package
From Eclipse.org
If Eclipse is unavailable by the package manager of your distribution have a look at the Eclipses package comparision page and choose that, which covers most of your needs - obvisous it should include C/C+. Then get it from the Eclipse download page.
A new main release is usually every year at the end of june available.
With Synaptic under Ubuntu / Debian
It's 2010/02/24 and the latest stable Ubuntu is 9.10 "Karmic." I believe the Debian procedure may be similar. HOWEVER, the Ubuntu packages may not be in sync with Debian.
There have been some bugs reported that affect the function of the Eclipse windows and buttons. See http://blog.export.be/2009/10/fixing-eclipse-for-ubuntu-karmic-koala-9-10/ and https://bugs.eclipse.org/bugs/show_bug.cgi?id=291257 for some details, and a corresponding Launchpad bug with workaround is here: https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/458703
This problem with GTK may explain the redraw issues I describe in the steps below...?
Install Eclipse
Open Synaptic Package Manager or Aptitude or whatever and install the Eclipse package. The current version as of these instructions is "Galileo," version 3.5.1.
Required Plugins
Add Plugin and Development Tool Software Sites in Eclipse
Note: In more recent version you can simply search Help->Eclipse Marketplace for your desired plugins.
Note: Replace "Galileo" with with the name of your Eclipse release.
For some reason the Galileo Eclipse package installs with NO default links to the standard software sites. So the Help --> Install New Software panel has NOTHING in it until you add the appropriate URLs.
- Add the Galileo repository: click Add...
Name: Galileo Location: http://download.eclipse.org/releases/galileo
- Add the Schemeway repository: click Add...
Name: Schemeway Location: http://schemeway.sourceforge.net/update-site
- Once the software sites are included it's easy to install the C environment and Schemeway.
Install C/C++ if not already part of your package
This is recommend also if you work on the documentation (gnucash-doc) or the website (htdocs), because they all make use of the autotools (configure, make, ...), which can be accessed by this package.
- choose Help --> Install New Software
- In the Work with menu, choose Galileo. (For some odd reason, nothing shows up in the software list on my system. I found I could put a * or Enter or something in the filter text field and the software list shows up.)
- Scroll down to Programming Languages
- Choose Eclipse C/C++ Development Tools (Currently this installs version 6.0.0.200909110608)
- Click the Next button a few times, maybe answer a licensing question, and then the Finish button. It takes a few minutes to finish.
Install Schemeway if you wish to work on Guile (Reports etc.)
- (You may already be here) Help --> Install New Software
- In the Work With menu, choose Schemeway.
- Put an * or Enter or something in the filter text field to make the list show up.
- Choose "SchemeWay Feature" (Currently this installs version 1.2.15)
- Click the Next button a few times, maybe answer a licensing question, and then the Finish button. It takes a few seconds to finish.
Install a SVN package if you wish to upate your repository from inside Eclipse
As of july 2012 there are 2 Eclipse packages for SVN:
- Subclipse works fine for the downstream (svn checkout; svn update; ...), but I didn't find the way to commit.
- Subversive with the SVNKit backend works in both directions. In the User Credentials dialog leave the General tab (user name; password) blank and fill the "SSH Settings" tab (file; passphrase). For some reasons if you access svn.gnucash.org often a dialog containing the general tab appears. Leave it empty, else you would lock your svn access.
Other useful packages depending on your task
- Linux Tools has a bunch of useful tools - if you are on Linux.
- There are several XML editors and tools if you wish to work on the documentation or account chart templates.
- If you favor GIT over SVN, there are also several tools.
Working with Eclipse on GnuCash
With Eclipse >= 3.6 ("Helios") and the CDT >= 7.x installed, using eclipse to develop gnucash is rather easy, but there are several ways possible:
- use Eclipse only as IDE for editing and debugging and traditional command line tools for the rest
- install and learn how to
- use plugins for git or svn
- configure the autotools chain in CDT to work the GnuCash way
The quick way
- Get a local working copy of gnucash from SVN, as described on the SVN page, as follows:
svn checkout http://svn.gnucash.org/repo/gnucash/trunk gnucash cd gnucash
- Open a console and change into the directory of the newly created working copy. As described on Building, call
./autogen.sh mkdir build # Create the separate build directory cd build ./configure
- If that completed without error, start your Eclipse 3.6. Choose File -> New -> Other... -> C++ -> "Makefile Project with Existing Code". Choose some project name for yourself, and choose the newly created working copy directory as "Existing Code Location". Choose the "GNU Autotools Toolchain" as toolchain. Click Finish.
You can now edit the source code and also call "Build Project", and this will work as expected, i.e. it will result in the "gnucash" executable in src/bin.
Getting eclipse 3.x to work with gnucash
Precondition: Check out the sources. It might be best to make sure first that gnucash compiles and installs, before starting over with eclipse.
- Download Eclipse IDE for C/C++ Developers from [1] and extract to some folder
- Start eclipse
- Create a new C-Project: File->New -> Empty C-Project:
- Location: enter the path to the existing source folder (e.g. C:\soft\gnucash\repos)
- deselect "Show project types and toolsets only if they are supported by the platform"
- Select Toolchain: "MinGW GCC"
- Import include files: This is somehow ugly because you must set each directory you require.
- To browse the .h-includefiles you must enter each folder to the include path:
- Project ->Properties -> C/C++ Build -> Tab "Tool Settings" -> Directories: add the relevant include paths: e.g. "${workspace_loc:/gnucash/lib/libqof/backend}", ${workspace_loc:/gnucash/src/app-utils} etc. and C:\soft\gnome\include\gtk-2.0 and so on
- See also http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_add_an_external_library_to_my_C.2B.2B_project.3F
- To browse the .h-includefiles you must enter each folder to the include path:
There is much more support available:
- Plugin for Subversion integration (subclipse). This is very helpful, because differences are highlighted in the editor. (Install Subclipse and also the Client Adapter for JavaHL. Then open the context menu on the project and select Team->Share Project)
- Scheme editor plugin: schemeway (You will also have to install "Eclipse Java Development Tools" and "Eclipse Plug-in Development Environment" via Help->Software Updates->Available Software-><eclipse version codename> e.g. Ganymede.)
Edit
Some useful hints for editing:
- CTRL+Shift+T: Open Element (function, variable, Macro etc)
- CTRL+Shift+R: Open file
- F3: open the definition of an element
- CTRL+Alt+h: open call hierarchy
... and much more...
Build (not to build)
Eclipse won’t be a good help for building. You are always faster if you make_install in a shell window for the directory tree you were editing. To avoid annoying warnings, you should turn off automatic build:
- Project -> Build automatically
- Preferences->Run/Debug->Launching->"build (if required) before launching".
Debug
You can use eclipse as a debugging interface. The idea is to attach eclipse to the running gnucash process.
- Run->Open Debug Dialog ->"C/C++ Attach to local app" -> New
- Select C:\soft\gnucash\inst\bin\gnucash-bin.exe
- You must specify the path to your source folder: Path mapping "../../../repos" to "C:\soft\gnucash\repos"
- Now start gnucash as usual from inst/bin (ignore warnings about errors in workspace)
- Launch your debugging configuration in eclipse
- Select the process to attach to (gnucash-bin.exe)
- The process will be interrupted. Try if you can browse to gnc_ui_start_event_loop. If not start over with the Source tab (see step 3).
- Make sure you have put some breakpoints in and hit Continue
- If a breakpoint is encountered you can step through with F6, F5 etc., inspect variables and so on.