Feature #487

Add developer info wiki page on how to develop GammaLib with an IDE like Eclipse / XCode

Added by Deil Christoph over 11 years ago. Updated over 11 years ago.

Status:NewStart date:09/16/2012
Priority:NormalDue date:
Assigned To:Deil Christoph% Done:

10%

Category:-
Target version:-
Duration:

Description

It would be nice to have some info on how to develop GammaLib with an IDE like Eclipse or XCode.
There are many advantages like auto code formatting, code completion, static code analysis, links from build warnings / errors to code lines, ...
However it’s not obvious and sometimes not even possible to configure the project correctly in the IDE so that everything works, and if someone has figured this stuff it would be nice to add a short description on the developer wiki pages.

One thing I did was check out the git repo via the command line and then in Eclipse CDT:
Import → Existing Code as Makefile Project → Select MacOSX GCC toolchain for the indexer.
Right-click Project → Index → Rebuild (takes a few seconds)
Right-click Project → Run C/C++ Code Analysis (takes a minute)

The CODAN static analyzer shows 20 errors, but I believe that is a CODAN error and gammalib is fine:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389676

It also shows three warnings, which we might as well fix:
Description Resource Path Location Type
Member 'm_sigma’ was not initialized in this constructor test_GNumerics.hpp /gammalib/test line 52 Code Analysis Problem
Member 'm_num’ was not initialized in this constructor test_GVector.hpp /gammalib/test line 33 Code Analysis Problem
Catching by reference is recommended 'GException::matrix_not_factorised’ test_GSparseMatrix.cpp /gammalib/test line 988 Code Analysis Problem

Code completion, outline, and navigation work fine (except for the one bug mentioned above), so it’s already quite useful.

TODO:
- How to build from Eclipse? There is the option to import as an autotools project, but I didn’t try that yet.
- How to run unit tests from Eclipse?
- Why doesn’t Eclipse automatically recognize that this is a git repo? It did that for all other projects I imported previously.

Really on Mac, XCode with Clang on the fly compilation / code analysis should be better than Eclipse, but I didn’t try that yet.


Recurrence

No recurrence.

History

#1 Updated by Deil Christoph over 11 years ago

Jürgen: Moved to Bug #505.

#2 Updated by Knödlseder Jürgen over 11 years ago

Thanks for catching those. For ctools related issues, please post the bugs in the ctools project. I just moved over that one to Bug #505.

#3 Updated by Knödlseder Jürgen over 11 years ago

I tried Eclipse some time ago, but not recently. Yet I tried the autotools project thing and it worked. If you gain some experience on it, don’t hesitate to start a new Wiki page on using Eclipse.

The same for Xcode. I use Xcode as editor, but I have not tried compiling the library using Xcode features. Also here, if you gain some experience don’t hesitate to start a Wiki page.

Thanks for running the static code analyzer. cppcheck runs regularly on GammaLib, and I know that there are still a bunch of style errors (see https://cta-jenkins.irap.omp.eu/job/gammalib-analyse/lastBuild/cppcheckResult/?). Apparently, those found by CODAN are different.

I’m not sure why enumerations should not be used in classes. Here two weblinks where the usage of enumerations within C++ classes is described:
http://msdn.microsoft.com/en-us/library/2dzy4k6e(v=vs.71).aspx
http://www.yolinux.com/TUTORIALS/C++Enum.html
Isn’t this rather a CODAN problem.

Concerning the NULL, CODAN is somehow right, they should not be used in C++ code. Here some web links (one in french) telling the story:
http://h-deb.clg.qc.ca/Sujets/Divers--cplusplus/CPP--NULL.html
http://www.cplusplus.com/forum/beginner/5604/
Needs to be checked whether the NULLs should be replaced by “0” or “nullptr”.

I just fixed the three CODAN warnings.

#4 Updated by Knödlseder Jürgen over 11 years ago

  • % Done changed from 0 to 10

Also available in: Atom PDF