[Xapian-devel] 回复: A beginner in "Posting list encoding improvements"

Olly Betts olly at survex.com
Thu Feb 13 05:32:48 GMT 2014


On Thu, Feb 13, 2014 at 10:34:00AM +0800, Hurricane Tong wrote:
> I think what i did is the same with you except i use make rather than
> make -sj8, and I did as root.

It's better to create yourself a user for development work and do as
little as possible as root.  The root user has the rights to do almost
anything, so you can accidentally do a lot of damage (e.g.  "rm *" in
the wrong directory) and a malicious program can do a lot more damage
too.

But compiling as root shouldn't make a difference here.

> root at hurricanetong-VirtualBox:/home/hurricanetong/workspace# g++ `xapian-config --cxxflags --libs` demo2.cpp
> /tmp/ccRXtBxB.o: In function `main':
> demo2.cpp:(.text+0x4a): undefined reference to `Xapian::WritableDatabase::WritableDatabase(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
> demo2.cpp:(.text+0x73): undefined reference to `Xapian::WritableDatabase::~WritableDatabase()'
> demo2.cpp:(.text+0x98): undefined reference to `Xapian::WritableDatabase::~WritableDatabase()'
> collect2: ld 返回 1

I don't know why this isn't working, as it does for me and others.

Passing the libs last might be worth trying:

g++ `xapian-config --cxxflags` demo2.cpp `xapian-config --libs`

You can also compile with -v to see more details of the process:

g++ -v `xapian-config --cxxflags --libs` demo2.cpp

What version of Ubuntu have you installed?

Cheers,
    Olly



More information about the Xapian-devel mailing list