无法在CMake C ++项目中包含LibXML2文件(使用QtCreator IDE)

时间:2015-12-13 10:58:11

标签: c++ qt-creator libxml2 mlpack

我正在QtCreator中开发基于Cmake的C ++项目。我试图在我的项目中使用mlpack,但是只要我将#include <mlpack/core.hpp>行包含在我唯一的源文件中,就会收到与mlpack / core.hpp中包含的某些libxml文件有关的错误:

    In file included from /usr/local/include/mlpack/core/util/save_restore_utility.hpp:26:0,
             from /usr/local/include/mlpack/core.hpp:171,
             from /home/revinci/code/workspaces/qt_ws/Semantic_Perception/src/features_slic.cpp:18:
    /usr/include/libxml2/libxml/parser.h:15:31: fatal error: libxml/xmlversion.h: No such file or directory
    #include <libxml/xmlversion.h>

现在,我进入/usr/include/libxml2/libxml/并找到parser.h,其中包含#include <libxml/xmlversion.h>行。 所以,我看到xmlversion.hparser.h位于同一文件夹中并尝试了黑客攻击:我将#include <libxml/xmlversion.h>中的parser.h更改为#include "xmlversion.h"只是为了获得以下错误:

    In file included from /usr/include/libxml2/libxml/parser.h:15:0,
             from /usr/local/include/mlpack/core/util/save_restore_utility.hpp:26,
             from /usr/local/include/mlpack/core.hpp:171,
             from /home/revinci/code/workspaces/qt_ws/Semantic_Perception/src/features_slic.cpp:18:
    /usr/include/libxml2/libxml/xmlversion.h:13:31: fatal error: libxml/xmlexports.h: No such file or directory
    #include <libxml/xmlexports.h>

这基本上告诉我找不到xmlexports.hxmlversion.h包含)。更重要的是,xmlexports.hxmlversion.hparser.h位于同一目录中!

我尝试了提及here的解决方案并安装了libxml2-dev(再次)和libxslt1-dev,但我的问题没有解决。

我认为这可能与正确指定包含路径有关。我已尝试将/usr/include/libxml2添加到QtCreator中我的构建环境中存在的各种路径环境变量(PATHINCLUDE_PATHCPATH),但无济于事。我的CMakeLists.txt看起来像这样:

    project(Semantic_Perception)
    cmake_minimum_required(VERSION 2.8)



    #Vigra Headers
    include_directories(
        include
    )
    file(GLOB_RECURSE VigraImpex include/impex/)
    add_library(VigraImpex ${VigraImpex})

    #LibXml2 Headers
    find_package(LibXml2 REQUIRED)

    #Armadillo Headedrs
    find_package(Armadillo REQUIRED)
    include_directories(${ARMADILLO_INCLUDE_DIRS})

    #Boost Headers
    find_package(Boost 1.54.0 REQUIRED)



    add_executable(features_slic src/features_slic.cpp)
    target_link_libraries(features_slic
        VigraImpex
        ${ARMADILLO_LIBRARIES}
    )
BTW:LibXml2,Armadillo和Boost都是我试图使用的库的依赖 - mlpack 。命令find_pakcage(mlpack)不起作用,因为我的系统上没有任何Findmlpack.cmake文件,我也无法在互联网上找到。{/ p>

0 个答案:

没有答案