Menu

how to use lemur in eclipse whith C++

2011-07-19
2012-09-27
  • tian chengbo

    tian chengbo - 2011-07-19

    hello,I want to use lemur in C++,however,when I follow this instruction :
    http://sourceforge.net/apps/trac/lemur/wiki/Using%20the%20API%20to%20Write%20
    Your%20Own%20Application

    I got some errors as following:

    /usr/local/lib/liblemur.a(main.o): In function `main':
    /home/boge/software/experiment/lemur-4.12/utility/obj/../src/main.cpp:38: undefined reference to `GetAppParam()'
    /home/boge/software/experiment/lemur-4.12/utility/obj/../src/main.cpp:42: undefined reference to `AppMain(int, char**)'
    /home/boge/software/experiment/lemur-4.12/utility/obj/../src/main.cpp:33: undefined reference to `GetAppParam()'
    collect2: ld returned 1 exit status
    make: *** [lemur] 错误 1
    

    In my Makefile.app,the parameters are:
    OBJS = /usr/local/lib/liblemur.a
    PROG = lemur

    and my structure of the progect is:
    --lemur
    --Debug
    --src
    --myindex.cc
    --Makefile.app

    How can I fix it,can anybody give me some suggestions,thank you!
    mentions: I have install the lemur correctly,and I can use lemur in java with
    jni.

     
  • tian chengbo

    tian chengbo - 2011-07-19

    Here is the myindex.cc:

    #include "Index.hpp"
    #include "IndexManager.hpp"
    #include <string>
    using namespace lemur::api;
    using namespace std;
    
    int main(int argc, char *argv[]) {
        string indexPath="/home/boge/workspace1/IDF_casedbased/indexs/ct/p";
        Index *theIndex=IndexManager::openIndex(indexPath);
        int numDocuments=theIndex->docCount();
        float avgDocLength=theIndex->docLengthAvg();
        int totalTermCount=theIndex->termCount();
        int uniqueTermCount=theIndex->termCountUnique();
        cout << "# documents: " << numDocuments << endl;
        cout << "Avg. Document Length: " << avgDocLength << endl;
        cout << "# terms: " << totalTermCount << endl;
        cout << "# unique terms: " << uniqueTermCount << endl;
        delete theIndex;
    }
    
     
  • tian chengbo

    tian chengbo - 2011-07-19

    I have fix this problem,
    OBJS = /usr/local/lib/liblemur.a
    should be like this:
    OBJS = /home/boge/workspace-indri/lemur/src/myindex.cc

    But I have another problem, I want build my project in eclipse, so how to
    configure my environment.
    I have a try just like how to configure "Boost" library in eclipse:

    in eclipse's c++project ,I only set the “liblemur.a“:
    c/c+ Build >> settings >> cross G++ linker >> Miscellaneous >> other objects >> /usr/local/lib/liblemur.a
    

    But this can't work, how can I fix this one,thank you!

     

Log in to post a comment.