c++ - 我想在 QT 中使用 LEMUR 库

标签 c++ qt lemur

我想在 QT 中使用 LEMUR 库,但我需要一些帮助。 我那里有说明:instructions

makeFile.app 包含:

    # 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=\"project@lemurproject.org\" -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=\"project@lemurproject.org\" -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)

最后我写了 QT4 作为我的程序和 main.cpp 作为我的对象但是它不起作用。当我运行 make -f MakeFile.app 时,我的终端出现错误

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

如果我使用带有 QT 的构建按钮进行编译,我会收到此错误:

    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'

在我的 QT 项目中,我只有一个 .pro 文件和 main.cpp 在我的 .pro 文件中,我有库和路径

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

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

主要.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();
}

有人可以帮我吗?

感谢

最佳答案

就在 include 指令之前 #include "lemur-blah blah.h" 添加

using namespace __gnu_cxx;

这是由于预处理器指令 P_NEEDS_GNU_CXX_NAMESPACE

关于c++ - 我想在 QT 中使用 LEMUR 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25405868/

相关文章:

c++ - 了解通过 ASSIMP 加载 OBJ

c++ - 如何捕获 vector 中的 .erase 异常?

c++ - 如何将 unicode 字符串转换为其 unicode 转义字符?

通过 JNI/C++ 调用时未找到 Java 方法

c++ - 模板函数 C++,接受参数 U 并返回 T

c++ - Qt drawRect 在后台

linux - 在 Linux 机器上安装 Lemur

information-retrieval - 在 Galago 中删除停用词来索引集合

c++ - boost中的安全 bool 成语?