How to use STXXL with Qt?

  • Isaac Perez

    Isaac Perez - 2014-07-04


    I want to use the library STXXL with Qt, but I don't know what I should to add to the Qt project file (the .pro file).

    So far I have built and run a couple of STXXL sample program, but I did it with CMake. Do not know exactly what to do in the case of Qt? or if is possible work STXXL + Qt?

    Thanks in advance for any help and/or suggestion.

  • Timo Bingmann

    Timo Bingmann - 2014-07-06

    STXXL has very few additional libraries, and they are all standard system libraries like pthread, openmp or rt. Simply add the include path and library to the Qt project, and then all libraries it is missing.

    As to the interaction of Qt and STXXL: no idea, as there is no precendece. But it shouldnt be a problem.

  • Isaac Perez

    Isaac Perez - 2014-07-08

    Thanks for your answer. I added the following the lines to my Qt project file (.pro file):

    INCLUDEPATH += /usr/include/stxxl
    LIBS += -lpthread -lstxx
    QMAKE_CXXFLAGS += -fopenmp

    However, I do not know if I need to add something more.

    Now, with these lines in my .pro ​​file I get various error messages.
    I must say, however, that the error messages given by Qt creator do not appear to be related to STXXL (actually I do not know where those messages come from). For example, I get error messages like the following:

    /usr/include/c++/4.9.0/parallel/multiway_mergesort.h: 421: error:undefined reference to `omp_get_num_threads’.

    I welcome any help and/or suggestions that brings light to this problem.
    Thanks in advance.

  • Timo Bingmann

    Timo Bingmann - 2014-07-08

    That look's about right. The error you are getting should be fixed by the -fopenmp you already added. So maybe the QMAKE_CXX_FLAGS is wrong?

  • Isaac Perez

    Isaac Perez - 2014-07-10

    the qmake flag QMAKE_CXXFLAGS has the value: -m64 -pipe (before I add -fopenmp)

    Can these compiler flags be causing interference?

  • Isaac Perez

    Isaac Perez - 2014-07-10

    In good time!...I solved (I think) the problem I had.

    I add -lgomp to the LIBS variable of qmake and I achieved build and run a stxxl example program (phonebills) using QtCreator.

    In summary for the STXXL library work with Qt I add the following lines in my Qt project file (.pro file):

    INCLUDEPATH += /usr/include
    LIBS += -lpthread -lgomp -lstxxl
    QMAKE_CXXFLAGS += -fopenmp

    Thanks to everyone in the forum for your help, I hope what I posted will be also helpful for others.


Log in to post a comment.