FAQ
Hi,
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:

http://gcc.gnu.org/ml/gcc-regression/2004-04/msg00018.html

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.

-owen

Search Discussions

  • Garrett Rooney at Jul 6, 2005 at 4:00 am

    Owen McCabe wrote:
    Hi,
    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:

    http://gcc.gnu.org/ml/gcc-regression/2004-04/msg00018.html

    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.
    Weird. It's kind of odd that g++ is failing to compile headers
    generated by gcj... I'd say that unless it's actually failing for a
    released version of gcc there isn't a whole lot of point in us doing
    anything about it though.

    -garrett

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupc-dev @
categorieslucene
postedJul 6, '05 at 3:56a
activeJul 6, '05 at 4:00a
posts2
users2
websitelucene.apache.org

2 users in discussion

Owen McCabe: 1 post Garrett Rooney: 1 post

People

Translate

site design / logo © 2021 Grokbase