Difference between revisions of "Eclipse"

From GnuCash
Jump to: navigation, search
(New article about eclipse as IDE for gnucash)
 
(Formating)
Line 2: Line 2:
 
= Getting eclipse to work with gnucash =
 
= Getting eclipse to work with gnucash =
 
Precondition: Make sure gnucash compiles and installs successfully, before starting over with eclipse.
 
Precondition: Make sure gnucash compiles and installs successfully, before starting over with eclipse.
# Download Eclipse IDE for C/C++ Developers from http://www.eclipse.org/downloads/ and extract to some folder
+
# Download Eclipse IDE for C/C++ Developers from [http://www.eclipse.org/downloads/] and extract to some folder
 
# Start eclipse
 
# Start eclipse
 
# Create a new C-Project: File->New -> Empty C-Project:  
 
# Create a new C-Project: File->New -> Empty C-Project:  
Line 8: Line 8:
 
## deselect "Show project types and toolsets only if they are supported by the platform"
 
## deselect "Show project types and toolsets only if they are supported by the platform"
 
## Select Toolchain: "MinGW GCC"
 
## 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
  
# Import include files
+
There is much more support available:  e.g. an eclipse plugin for Subversion integration ([http://subclipse.tigris.org/install.html subclipse]) and also a very helpful scheme editor plugin: [http://schemeway.sourceforge.net schemeway]
This is somehow ugly as you must give each directory individually.
 
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
 
 
 
There is much more support available:  e.g. an eclipse plugin for Subversion integration (subclipse) and also a very helpful scheme editor plugin: schemeway.sourceforge.net
 
  
 
= Edit =
 
= Edit =
Line 27: Line 23:
 
... and much more...
 
... and much more...
  
= Build =
+
= Build (not to build) =
Eclipse won’t help you much here. You are always faster if you make_install in a shell window in the directory tree you were editing. To avoid annoying warnings you should turn off automatic 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
 
* Project -> Build automatically
 
* Preferences->Run/Debug->"build (if required) before launching".
 
* Preferences->Run/Debug->"build (if required) before launching".
  
 
= Debug =
 
= Debug =
Debugging is also possible:
+
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
 
# Run->Open Debug Dialog ->"C/C++ Attach to local app" -> New
 
# Select C:\soft\gnucash\inst\bin\gnucash-bin.exe
 
# Select C:\soft\gnucash\inst\bin\gnucash-bin.exe
Line 43: Line 38:
 
# 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).
 
# 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
 
# 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.
+
# If a breakpoint is encountered you can step through with F6, F5 etc., inspect variables and so on.

Revision as of 23:03, 20 December 2008

Eclipse 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/

Getting eclipse to work with gnucash

Precondition: Make sure gnucash compiles and installs successfully, before starting over with eclipse.

  1. Download Eclipse IDE for C/C++ Developers from [1] and extract to some folder
  2. Start eclipse
  3. Create a new C-Project: File->New -> Empty C-Project:
    1. Location: enter the path to the existing source folder (e.g. C:\soft\gnucash\repos)
    2. deselect "Show project types and toolsets only if they are supported by the platform"
    3. Select Toolchain: "MinGW GCC"
  4. 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

There is much more support available: e.g. an eclipse plugin for Subversion integration (subclipse) and also a very helpful scheme editor plugin: schemeway

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->"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.

  1. Run->Open Debug Dialog ->"C/C++ Attach to local app" -> New
  2. Select C:\soft\gnucash\inst\bin\gnucash-bin.exe
  3. You must specify the path to your source folder: Path mapping "../../../repos" to "C:\soft\gnucash\repos"
  4. Now start gnucash as usual from inst/bin (ignore warnings about errors in workspace)
  5. Launch your debugging configuration in eclipse
  6. Select the process to attach to (gnucash-bin.exe)
  7. 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).
  8. Make sure you have put some breakpoints in and hit Continue
  9. If a breakpoint is encountered you can step through with F6, F5 etc., inspect variables and so on.