Hi all, I used Xapian with Python but now I want to try it with C++. So, I tried to compile the examples : g++ simpleindex.cc -o simpleindex But I have some errors : /tmp/ccl7xhUF.o: In function `main': simpleindex.cc:(.text+0x12c): undefined reference to `Xapian::WritableDatabase::WritableDatabase(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' simpleindex.cc:(.text+0x16e): undefined reference to `Xapian::TermGenerator::TermGenerator()' simpleindex.cc:(.text+0x1c9): undefined reference to `Xapian::Stem::Stem(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' simpleindex.cc:(.text+0x212): undefined reference to `Xapian::TermGenerator::set_stemmer(Xapian::Stem const&)' simpleindex.cc:(.text+0x2be): undefined reference to `Xapian::Document::Document()' simpleindex.cc:(.text+0x2d0): undefined reference to `Xapian::Document::set_data(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' simpleindex.cc:(.text+0x2e2): undefined reference to `Xapian::TermGenerator::set_document(Xapian::Document const&)' simpleindex.cc:(.text+0x371): undefined reference to `Xapian::WritableDatabase::add_document(Xapian::Document const&)' simpleindex.cc:(.text+0x3b0): undefined reference to `Xapian::Document::~Document()' simpleindex.cc:(.text+0x3c9): undefined reference to `Xapian::Document::~Document()' simpleindex.cc:(.text+0x47d): undefined reference to `Xapian::Stem::~Stem()' simpleindex.cc:(.text+0x496): undefined reference to `Xapian::Stem::~Stem()' simpleindex.cc:(.text+0x4a9): undefined reference to `Xapian::TermGenerator::~TermGenerator()' simpleindex.cc:(.text+0x4c2): undefined reference to `Xapian::TermGenerator::~TermGenerator()' simpleindex.cc:(.text+0x4d5): undefined reference to `Xapian::WritableDatabase::~WritableDatabase()' simpleindex.cc:(.text+0x4ee): undefined reference to `Xapian::WritableDatabase::~WritableDatabase()' simpleindex.cc:(.text+0x53a): undefined reference to `Xapian::Error::get_description() const' /tmp/ccl7xhUF.o: In function `Xapian::TermGenerator::index_text(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': simpleindex.cc:(.text._ZN6Xapian13TermGenerator10index_textERKSsjS2_[Xapian::TermGenerator::index_text(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x34): undefined reference to `Xapian::TermGenerator::index_text(Xapian::Utf8Iterator const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: ld returned 1 exit status Does somebody know about this error?? Thank you!
Justine Demeyer wrote:> Hi all, > > I used Xapian with Python but now I want to try it with C++. So, I tried to > compile the examples : > > g++ simpleindex.cc -o simpleindex > > But I have some errors : > > /tmp/ccl7xhUF.o: In function `main': > simpleindex.cc:(.text+0x12c): undefined reference to > `Xapian::WritableDatabase::WritableDatabase(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, int)' > simpleindex.cc:(.text+0x16e): undefined reference to > `Xapian::TermGenerator::TermGenerator()' > simpleindex.cc:(.text+0x1c9): undefined reference to > `Xapian::Stem::Stem(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&)' > simpleindex.cc:(.text+0x212): undefined reference to > `Xapian::TermGenerator::set_stemmer(Xapian::Stem const&)' > simpleindex.cc:(.text+0x2be): undefined reference to > `Xapian::Document::Document()' > simpleindex.cc:(.text+0x2d0): undefined reference to > `Xapian::Document::set_data(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&)' > simpleindex.cc:(.text+0x2e2): undefined reference to > `Xapian::TermGenerator::set_document(Xapian::Document const&)' > simpleindex.cc:(.text+0x371): undefined reference to > `Xapian::WritableDatabase::add_document(Xapian::Document const&)' > simpleindex.cc:(.text+0x3b0): undefined reference to > `Xapian::Document::~Document()' > simpleindex.cc:(.text+0x3c9): undefined reference to > `Xapian::Document::~Document()' > simpleindex.cc:(.text+0x47d): undefined reference to `Xapian::Stem::~Stem()' > simpleindex.cc:(.text+0x496): undefined reference to `Xapian::Stem::~Stem()' > simpleindex.cc:(.text+0x4a9): undefined reference to > `Xapian::TermGenerator::~TermGenerator()' > simpleindex.cc:(.text+0x4c2): undefined reference to > `Xapian::TermGenerator::~TermGenerator()' > simpleindex.cc:(.text+0x4d5): undefined reference to > `Xapian::WritableDatabase::~WritableDatabase()' > simpleindex.cc:(.text+0x4ee): undefined reference to > `Xapian::WritableDatabase::~WritableDatabase()' > simpleindex.cc:(.text+0x53a): undefined reference to > `Xapian::Error::get_description() const' > /tmp/ccl7xhUF.o: In function > `Xapian::TermGenerator::index_text(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, unsigned int, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)': > simpleindex.cc:(.text._ZN6Xapian13TermGenerator10index_textERKSsjS2_[Xapian::TermGenerator::index_text(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, unsigned int, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)]+0x34): undefined reference to > `Xapian::TermGenerator::index_text(Xapian::Utf8Iterator const&, unsigned > int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)' > collect2: ld returned 1 exit status > > > Does somebody know about this error?? > Thank you! > _______________________________________________ > Xapian-discuss mailing list > Xapian-discuss at lists.xapian.org > http://lists.xapian.org/mailman/listinfo/xapian-discuss > >This worked for me: g++ -o simpleindex -L/usr/local/lib -l xapian simpleindex.cc You may have to adjust the -L parameter to point to your xapian libraries. Jim.