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
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