2017-09-26 34 views
1

我试图在我的笔记本电脑上运行this项目。我已经安装了以下的东西。使用CUDA和C++运行现有项目

CUDA:

nvcc: NVIDIA (R) Cuda compiler driver 
Copyright (c) 2005-2015 NVIDIA Corporation 
Built on Tue_Aug_11_14:27:32_CDT_2015 
Cuda compilation tools, release 7.5, V7.5.17 

GCC:

gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904 
Copyright (C) 2015 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

的CMake:

cmake version 3.5.1 

make。该项目出现以下错误。

/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. 

如果我为了支持C++标准11.添加set (CMAKE_CXX_STANDARD 11)CMakesLists.txt我碰到下面的错误。

In file included from /usr/include/mrpt/base/include/mrpt/utils.h:25:0, 
       from /home/muazzam/mywork/python/thesis/PD-Flow/scene_flow_visualization.h:24, 
       from /home/muazzam/mywork/python/thesis/PD-Flow/main_scene_flow_visualization.cpp:24: 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:253:8: error: ‘std::enable_if_t’ has not been declared 
    std::enable_if_t<is_shared_ptr<T>::value>* = nullptr) 
     ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:253:19: error: expected ‘,’ or ‘...’ before ‘<’ token 
    std::enable_if_t<is_shared_ptr<T>::value>* = nullptr) 
       ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:263:8: error: ‘std::enable_if_t’ has not been declared 
    std::enable_if_t<!is_shared_ptr<T>::value>* = nullptr) 
     ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:263:19: error: expected ‘,’ or ‘...’ before ‘<’ token 
    std::enable_if_t<!is_shared_ptr<T>::value>* = nullptr) 
       ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:261:6: error: ‘template<class RET, class T, class ... R> RET mrpt::utils::CStream::ReadVariant_helper(mrpt::utils::CSerializable::Ptr&, int)’ cannot be overloaded 
    RET ReadVariant_helper(
    ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:251:6: error: with ‘template<class RET, class T, class ... R> RET mrpt::utils::CStream::ReadVariant_helper(mrpt::utils::CSerializable::Ptr&, int)’ 
    RET ReadVariant_helper(
    ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: In member function ‘void mrpt::utils::CStream::WriteVariant(T)’: 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:314:15: error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14 
    t.match([&](auto& o) { this->WriteObject(o); }); 
      ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: In lambda function: 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:314:45: error: no matching function for call to ‘mrpt::utils::CStream::WriteObject(int&)’ 
    t.match([&](auto& o) { this->WriteObject(o); }); 
              ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:197:7: note: candidate: void mrpt::utils::CStream::WriteObject(const mrpt::utils::CSerializable*) <near match> 
    void WriteObject(const CSerializable* o); 
    ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:197:7: note: conversion of argument 1 would be ill-formed: 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:198:7: note: candidate: void mrpt::utils::CStream::WriteObject(const mrpt::utils::CSerializable&) 
    void WriteObject(const CSerializable& o) { WriteObject(&o); } 
    ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:198:7: note: no known conversion for argument 1 from ‘int’ to ‘const mrpt::utils::CSerializable&’ 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: At global scope: 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:524:28: error: ‘std::enable_if_t’ has not been declared 
template <typename T, std::enable_if_t<std::is_base_of< 
          ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:524:39: error: expected ‘>’ before ‘<’ token 
template <typename T, std::enable_if_t<std::is_base_of< 
            ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: In function ‘mrpt::utils::CStream& mrpt::utils::operator<<(mrpt::utils::CStream&, const mapbox::util::variant<Types ...>&)’: 
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:545:17: error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14 
    pObj.match([&](auto& t) { out << t; }); 
       ^
In file included from /usr/include/mrpt/base/include/mrpt/utils/TCamera.h:15:0, 
       from /usr/include/mrpt/base/include/mrpt/utils/CImage.h:16, 
       from /usr/include/mrpt/base/include/mrpt/utils.h:38, 
       from /home/muazzam/mywork/python/thesis/PD-Flow/scene_flow_visualization.h:24, 
       from /home/muazzam/mywork/python/thesis/PD-Flow/main_scene_flow_visualization.cpp:24: 
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h: At global scope: 
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:80:22: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type 
     typename = std::enable_if_t<std::is_enum<enum_t>::value>> 
        ^
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:80:33: error: expected ‘>’ before ‘<’ token 
     typename = std::enable_if_t<std::is_enum<enum_t>::value>> 
           ^
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:96:22: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type 
     typename = std::enable_if_t<!std::is_enum<data_t>::value>> 
        ^
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:96:33: error: expected ‘>’ before ‘<’ token 
     typename = std::enable_if_t<!std::is_enum<data_t>::value>> 
           ^
In file included from /home/muazzam/mywork/python/thesis/PD-Flow/main_scene_flow_visualization.cpp:24:0: 
/home/muazzam/mywork/python/thesis/PD-Flow/scene_flow_visualization.h:93:13: error: ‘COpenGLScenePtr’ in namespace ‘mrpt::opengl’ does not name a type 
    opengl::COpenGLScenePtr scene; 
      ^
CMakeFiles/Scene-Flow-Visualization.dir/build.make:62: recipe for target 'CMakeFiles/Scene-Flow-Visualization.dir/main_scene_flow_visualization.o' failed 
make[2]: *** [CMakeFiles/Scene-Flow-Visualization.dir/main_scene_flow_visualization.o] Error 1 
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Scene-Flow-Visualization.dir/all' failed 
make[1]: *** [CMakeFiles/Scene-Flow-Visualization.dir/all] Error 2 
Makefile:83: recipe for target 'all' failed 
make: *** [all] Error 2 

现在我不知道如何使这项工作。从一天起我就陷入这种困境。任何人都可以帮我建立这个项目吗?请。

+0

你尝试到'-std = C++ 11'添加到您的CMake标志? – Chiel

+0

嗨Chiel,我对Cmake颇为陌生。你能告诉我我应该在cmake文件中添加这行吗? – Mj1992

+0

我试过'SET(CMAKE_CXX_FLAGS -std = C++ 11)'但给了我同样的'std :: enable_if_t'错误。 – Mj1992

回答

2

std::enable_if_t在C++ 14只推出,所以你应该设定所要求的标准,以C++ 14:

set(CMAKE_CXX_STANDARD 14) 
+0

嗨,谢谢。这解决了大部分问题。但我仍然收到这个错误。它有某种相关性吗? '错误:命名空间mrpt :: opengl中的COpenGLScenePtr没有命名类型opengl :: COpenGLScenePtr场景' – Mj1992

+0

@ Mj1992似乎没有关系。 – Angew