I ran into a little trouble compiling lucene4c with a recent version
of gcc and I thought I'd document it here in case anyone else ran into
it. More specifically:

$ g++ --version
g++ (GCC) 4.0.1 20050517 (prerelease) (Debian 4.0.0-7ubuntu6~5.04ubp1)

gave me error messages like:

./include/org/apache/lucene/document/Field.h:24: error: global
qualification of class name is invalid before : token

This seems to stem from gcc refusing to compile code like this:

namespace extra {
class test;

class ::extra::test {

int main() {

That compiles just fine under both gcc 3.3 and the latest version of
comeau. The only reference I could find to this on google was:


So I'm not sure if it's back to compiling in a newer version or not yet.

Anyway, it's easy to work around it by replacing all the "class
::org"s in the header files with "class org" in lines like this:

class ::org::apache::lucene::document::Field : public ::java::lang::Object

So I'm not sure if the extra ::s are actually needed or not.


Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupc-dev @
postedJul 6, '05 at 3:56a
activeJul 6, '05 at 4:00a

2 users in discussion

Owen McCabe: 1 post Garrett Rooney: 1 post



site design / logo © 2021 Grokbase