Eclipse IDE for Windows Developing and Debugging

Before starting with Eclipse it's a good idea to make sure you can successfully build Golden Cheetah for Windows - see the guide here for more details on that.

Dependencies

As well as the dependencies for building for Windows (Qt SDK, Boost, qwt-plot3d) you will need a full MinGW installation and the Eclipse CDT (C/C++ Development Tooling) package.

I installed MinGW to C:\MinGW (adding C:\MinGW\bin to the Windows PATH) and extracted Eclipse to C:\Users\dhague\eclipse.
Don't extract Eclipse to C:\Program Files - it won't work properly on Windows 7 because of security issues.

Once Eclipse is installed, you may find it helpful to add Git support.

Creating an Eclipse project for Golden Cheetah

  • Start up Eclipse and go to the Workspace
  • Go to File / Import... and from the C/C++ folder select Existing Code as Makefile Project, then click Next
  • Browse to the GoldenCheetah folder (e.g. C:\Coding\GoldenCheetah) and select the MinGW GCC toolchain (see picture below)

  • Click Finish to import the project
  • If you have installed Git support in Eclipse, you can right-click on the project, select Team / Share Project... and choose Git.

If you expand the first level of the project, you should have something that looks like this:

Configuring the build

src/gcconfig.pri - uncomment CONFIG += debug and comment out CONFIG += static
qwt/qwtconfig.pri - uncomment CONFIG += debug and comment out CONFIG += release

To check everything works OK, perform a build from the Qt Command Prompt:

C:\Coding\GoldenCheetah> qmake -win32
C:\Coding\GoldenCheetah> mingw32-make

Make some tea while the build runs.

Project Properties

ALT-Enter will bring up the project Properties dialog. You should make the following changes:

  • Under C/C++ General / Paths and Symbols pick the Source Location tab and add the src folder
  • Under C/C++ Build / Tool Chain Editor, change the Current builder to Gnu Make Builder
  • Under C/C++ Build / Environment* create entries to match those in the file C:\Coding\Qt\2010.05\bin\qtenv.bat (note that SystemRoot in the PATH becomes ${SystemRoot} in the Eclipse PATH definition.
  • Next, under C/C++ Build on the Builder Settings tab uncheck "Use default build command" and set the build command to mingw32-make.
  • Also under C/C++ Build on the Builder Settings tab, uncheck "Generate Makefiles automatically" and then set the Build location to ${workspace_loc:/GoldenCheetah}
  • Next, under C/C++ Build on the Behaviour tab, uncheck the Workbench Build Behaviour boxes except for Build (Incremental build). If you have a multi-core CPU, you may wish to enable the parallel build option.
  • Shift-F9 will bring up a Make Targets dialog where you should add the target make with an empty make target:

Performing a build from Eclipse

First of all, from a Qt Command Prompt run:
C:\Coding\GoldenCheetah> qmake -win32
C:\Coding\GoldenCheetah> mingw32-make clean

You will only need to run the above commands once - future builds will run completely from Eclipse unless you make any edits to the .pri files.

Next, in Eclipse press F5 to refresh the project, then Shift-F9 - build the target "make". Make some more tea while it builds.

Test running the debug build

First you must make sure all the required DLLs are in C:\Coding\GoldenCheetah\src\debug:
  • libgcc_s_dw2-1.dll
  • mingwm10.dll
  • phonond4.dll
  • QtCored4.dll
  • QtGuid4.dll
  • QtNetworkd4.dll
  • QtOpenGLd4.dll
  • QtSqld4.dll
  • QtWebKitd4.dll
  • QtXmld4.dll
  • QtXmlPatternsd4.dll
  • qjpeg4.dll
  • qsqlite4.dll
  • qwtplot3d.dll

These are basically the same DLLs required for the normal Windows release version, except that the Debug versions of the Qt DLLs are used here (ending d4.dll instead of 4.dll)

Once these DLLs are copied into place, you should be able to run GoldenCheetah.exe from C:\Coding\GoldenCheetah\src\debug

Debugging from Eclipse

  • Right-click on the project and select Debug As and then Local C/C++ Application
  • If prompted to choose a local application, select GoldenCheetah.exe from /GoldenCheetah/src/debug
  • When prompted for a Debug Configuration, choose MinGW gdb
  • You may be prompted to switch to the Debug persepctive, and a main() window will be shown. Press F8 to continue running - after a few seconds, the Golden Cheetah window will appear.

You can switch back to the C/C++ Perspective in Eclipse and choose a breakpoint and perform the usual debugging actions.

Note: Although you can create new breakpoints while the application is running, they will not be activated until you close the application and start it running again.

GC-Project-Import.PNG (45 kB) Darren Hague, 12/30/2010 11:40 pm

GC-Project.PNG (111.6 kB) Darren Hague, 12/30/2010 11:40 pm

Make-Target.PNG (38.6 kB) Darren Hague, 12/30/2010 11:40 pm

Eclipse-Make-Settings.PNG (55.7 kB) Darren Hague, 12/30/2010 11:40 pm

Debug-GC-Eclipse.PNG (533.2 kB) Darren Hague, 12/30/2010 11:40 pm

Make-Target.PNG (40.8 kB) Darren Hague, 12/30/2010 11:43 pm

Debug-GC-Eclipse.jpg (408.6 kB) Darren Hague, 12/30/2010 11:49 pm