[Xapian-discuss] Compiling examples
Olly Betts
olly at survex.com
Sat Nov 1 18:17:36 GMT 2008
On Sat, Nov 01, 2008 at 07:19:42AM -0400, Jim wrote:
> 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
Note that you don't actually need to compile the examples yourself -
they're built by the xapian-core build system. But it's a useful small
testcase for problems building with Xapian.
> > 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,
> > [...]
>
> This worked for me:
> g++ -o simpleindex -L/usr/local/lib -l xapian simpleindex.cc
It's better (more portable and more future-proof) to use xapian-config
to get the required flags. (Also, "-lxapian" is more portable than
"-l xapian" I believe).
This is documented here (and possibly elsewhere too):
http://xapian.org/docs/quickstart.html
For example:
c++ quickstartindex.cc `xapian-config --libs --cxxflags` -o quickstartindex
Cheers,
Olly
More information about the Xapian-discuss
mailing list