Search code examples
c++qtlemur

I would like to use LEMUR library with QT


I would like to use LEMUR library with QT but i need some help. I have the instructions there : instructions

makeFile.app contains :

    # compiling C++ code
%.o: %.cpp
    $(CXX) $(CXXFLAGS) -o $@ -c $<
%: %.o
    $(CXX) $(CXXFLAGS) -o $@ $< $(CPPLDFLAGS)

prefix = /usr/local
exec_prefix = ${prefix}
INC = ${prefix}/include
#antlr is already set up properly for include path

LIBPATH = ${exec_prefix}/lib
LIB = lemur
CXX = g++
CFLAGS = -DPACKAGE_NAME=\"Lemur\" -DPACKAGE_TARNAME=\"lemur\" -DPACKAGE_VERSION=\"4.12\" -DPACKAGE_STRING=\"Lemur\ 4.12\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBZ=1 -DHAVE_NAMESPACES= -DISNAN_IN_NAMESPACE_STD= -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DNDEBUG=1 -g -O3  -I$(INC)
CXXFLAGS  = -DPACKAGE_NAME=\"Lemur\" -DPACKAGE_TARNAME=\"lemur\" -DPACKAGE_VERSION=\"4.12\" -DPACKAGE_STRING=\"Lemur\ 4.12\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBZ=1 -DHAVE_NAMESPACES= -DISNAN_IN_NAMESPACE_STD= -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FSEEKO=1 -DHAVE_MKSTEMP=1 -DHAVE_MKSTEMPS=1 -DHAVE_EXT_ATOMICITY_H=1 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -DNDEBUG=1 -g -O3 -I$(INC)


CPPLDFLAGS  =  -L$(LIBPATH) -l$(LIB) -lz -lpthread -lm 
## specify your object files here
OBJS = main.cpp
## specify your program here
PROG = Qt4

all: $(PROG)

$(PROG): $(OBJS)
    $(CXX) $(CXXFLAGS) -o $@ $^ $(CPPLDFLAGS)

clean:
    rm $(PROG) $(OBJS)

At the end i wrote QT4 as my program and main.cpp as my object but it doesn't work. I got an error in my terminal when i ran make -f MakeFile.app

main.cpp:1:35: fatal error: QtCore/QCoreApplication : no file or no folder about this type

If i compile using the build button with QT i got this error :

    In file included from /usr/local/include/indri/ref_ptr.hpp:21:0,
                 from /usr/local/include/indri/Repository.hpp:26,
                 from /usr/local/include/LemurIndriIndex.hpp:25,
                 from ../CBIRTest/main.cpp:9:
/usr/local/include/indri/atomic.hpp: In function 'void indri::atomic::increment(indri::atomic::value_type&)':
/usr/local/include/indri/atomic.hpp:51:33: error: '__atomic_add' was not declared in this scope
/usr/local/include/indri/atomic.hpp:51:33: note: suggested alternative:
/usr/include/c++/4.6/ext/atomicity.h:51:3: note:   '__gnu_cxx::__atomic_add'
/usr/local/include/indri/atomic.hpp: In function 'void indri::atomic::decrement(indri::atomic::value_type&)':
/usr/local/include/indri/atomic.hpp:55:35: error: '__atomic_add' was not declared in this scope
/usr/local/include/indri/atomic.hpp:55:35: note: suggested alternative:
/usr/include/c++/4.6/ext/atomicity.h:51:3: note:   '__gnu_cxx::__atomic_add'

In my QT project i have only a .pro file and main.cpp Inside my .pro file i have for the library and the path

INCLUDEPATH += I/usr/local/include/ \

LIBS += -L/usr/local/lib \

main.cpp

    #include <QtCore/QCoreApplication>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "lemur-compat.hpp"
#include "LemurIndriIndex.hpp"
#include "lemur-platform.h"



int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    
    return a.exec();
}

Can anyone help me with that ?

Thank


Solution

  • Just before the include directive #include "lemur-blah blah.h" add

    using namespace __gnu_cxx;
    

    This is due to the preprocessor directive P_NEEDS_GNU_CXX_NAMESPACE