luceneplusplus / LucenePlusPlus

Lucene++ is an up to date C++ port of the popular Java Lucene library, a high-performance, full-featured text search engine.
luceneplusplus@googlegroups.com
Other
738 stars 232 forks source link

Can't compile own Analyzer with MSVC with wrong order of includes #198

Open xlazom00 opened 1 year ago

xlazom00 commented 1 year ago

I am on windows with MSVC 2019 compiler I have class like this

//#include <Lucene.h>
#include <Analyzer.h>

class LucenePlusPlusNGramAnalyzer : public Lucene::Analyzer
{
public:
    LucenePlusPlusNGramAnalyzer( int32_t n, bool truncate )
{
}
Lucene::TokenStreamPtr tokenStream( const Lucene::String & fieldName, const Lucene::ReaderPtr & reader ) override
{
return {};
}

}

And compiler get me this:

1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\Collection.h(19,27): error C3861: 'LuceneSync': identifier not found 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\Collection.h(202): message : see reference to class template instantiation 'Lucene::Collection' being compiled 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\Map.h(17,20): error C3861: 'LuceneSync': identifier not found 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\Map.h(126): message : see reference to class template instantiation 'Lucene::Map<KEY,VALUE,LESS>' being compiled 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\Set.h(17,20): error C3861: 'LuceneSync': identifier not found 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\Set.h(129): message : see reference to class template instantiation 'Lucene::Set<TYPE,LESS>' being compiled 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\HashMap.h(17,24): error C3861: 'LuceneSync': identifier not found 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\HashMap.h(126): message : see reference to class template instantiation 'Lucene::HashMap<KEY,VALUE,HASH,EQUAL>' being compiled 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\HashSet.h(17,24): error C3861: 'LuceneSync': identifier not found 1>d:_WORK\qt651_x64\LucenePlusPlus\bin\include\lucene++\HashSet.h(110): message : see reference to class template instantiation 'Lucene::HashSet<TYPE,HASH,EQUAL>' being compiled

when I uncomment Lucene.h all works fine And I also get same compile error when I move #include after #include

Any idea why I need to include Lucene.h as first?