Archive for September, 2010

Generating C++ index files for Eclipse from the command line (Linux)

Posted on September 26, 2010. Filed under: Uncategorized | Tags: , , , , , , , , |

I finally managed to produce C++ index files by running the Eclipse CDT indexer from the command line (as opposed to running it from the IDE).

  1. I downloaded the most recent ‘Eclipse with CDT bundle’ from and unpacked it.
  2. I ran the indexer as follows on Linux:
    cd path-from-where-i-unpacked-the-eclipse-cdt-distribution
    cd eclipse
    ./eclipse \
    -data /tmp/ws \
    -nosplash \
    -application org.eclipse.cdt.core.GeneratePDOM \
    -target /tmp/test.pdom \
    -source /path-to-my-source-directory \
    -id "" \
    -include /path-to-my-source-directory


    • path-to-my-source-directory is the directory where the source I wanted to index is. For this project, this is also the top directory where its include files are searched.
    • path-from-where-i-unpacked-the-eclipse-cdt-distribution is the directory from which I unpacked the downloaded eclipse-cdt distribution.
    • I created a new directory /tmp/ws to be used as a pristine workspace (I suspected that in some attempts indexing stopped unexpectedly because it found some corrupted files in the workspace from previous indexing attempts).
    • /tmp/test.pdom is the index file to be generated.
    • The id option seems to be required and seems to be some kind of identifier identifying the indexed content, so I gave it the empty string.

Running this on the 2.5 million lines of C++ code project I’m working with at work took 21 minutes. I got zillions of error messages about unknown symbols which are mostly from the standard C++ and from external libraries. The summary at the end of the program was as follows:

C/C++ Indexer: Project '__prebuilt_index_temp__1285516188327' (13085 sources, 12099 headers)
 Options: indexer='PDOMFastIndexer', parseAllFiles=true, unusedHeaders=useDefaultLanguage, skipReferences=false,
   skipImplicitReferences=false, skipTypeReferences=false, skipMacroReferences=false.
 Database: 172355584 bytes
 Timings: 1074226 total, 209100 parser, 107105 resolution, 371885 index update.
 Errors: 0 internal, 61032 include, 1806 scanner, 3366 syntax errors.
 Names: 973647 declarations, 4173506 references, 1259869(19.66%) unresolved.
 Cache[34MB]: 763063990 hits, 1360364(0.18%) misses.
Indexer: completed PDOMRebuildTask[1076475ms]
== Generation ends

Indeed, /bin/ls -lh reports the size of the generated index file as 165 MBytes.

The project I ran it on also has other types of files (mostly xml, python and Fortran lines of source code according to sloccount). Running the CDT indexer on all files (without removing the non-C++ files) seemed to cause problems: the indexer stopped after a few seconds without producing an index file but unfortunately not saying anything about why it stopped prematurely.

I found some documentation on the command line indexer’s arguments here (in the “Common command-line options” section).

Now I can start exploiting the information contained in the generated index file.

Read Full Post | Make a Comment ( None so far )

Welcome !

Posted on September 14, 2010. Filed under: Uncategorized | Tags: , |

I discovered a huge ‘Welcome’ sign visible on Google Maps, directly behind the Geneva Airport runway (you’ll have to zoom out a little to see the runway):

I suspect that this was put in place on a farming field for the 2008 UEFA European Football Championship in Austria/Switzerland.

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...