Boost升级后编译时出现C ++ Boost错误

时间:2018-07-23 16:26:59

标签: c++ boost cmake

我有一个几年前创建的第三方代码(库),因此与最新的Boost无关。我正在使用Boost 1.64,并且正在尝试编译软件包。

我正在使用catkin和ROS(它们是机器人软件)来编译代码,但是错误似乎与C ++和Boost有关。

说实话,代码是别人写的,而不是我自己写的,所以我无法真正理解为什么失败和在哪里。我知道这段代码并不是为Boost 1.64写的,并且至少与Boost 1.54兼容。现在,我强迫catkin_make(在场景下使用cmake的漂亮工具)使用我自己的Boost版本(在/home/john/local/boost_1_64_0下)会产生以下错误。

错误如下:

~/catkin_ws$ catkin_make -DBoost_DIR=/home/john/local/boost_1_64_0 -DBOOST_ROOT=/home/john/local/boost_1_64_0 -DBOOST_LIBRARYDIR=/home/john/local/boost_1_64_0/lib -DBOOST_INCLUDEDIR=/home/john/local/boost_1_64_0/include -DBoost_NO_SYSTEM_PATHS=ON -DBoost_ADDITIONAL_VERSIONS="1.64;1.64.0"
Base path: /home/john/catkin_ws
Source space: /home/john/catkin_ws/src
Build space: /home/john/catkin_ws/build
Devel space: /home/john/catkin_ws/devel
Install space: /home/john/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/john/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/john/catkin_ws/build"
####
Scanning dependencies of target or_urdf_plugin
[ 50%] Building CXX object or_urdf/CMakeFiles/or_urdf_plugin.dir/src/urdf_loader.cpp.o
In file included from /home/john/catkin_ws/src/or_urdf/src/urdf_loader.cpp:7:0:
/home/john/catkin_ws/src/or_urdf/src/boostfs_helpers.h:21:5: error: ‘path’ does not name a type
     path& path::append< typename path::iterator >( typename path::iterator begin, typename path::iterator end, const codecvt_type& cvt)
     ^
In file included from /home/john/local/boost_1_64_0/include/boost/filesystem.hpp:16:0,
                 from /home/john/catkin_ws/src/or_urdf/src/boostfs_helpers.h:9,
                 from /home/john/catkin_ws/src/or_urdf/src/urdf_loader.cpp:7:
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp: In instantiation of ‘boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator) [with InputIterator = boost::filesystem::path::iterator]’:
/home/john/catkin_ws/src/or_urdf/src/boostfs_helpers.h:46:37:   required from here
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:888:73: error: no matching function for call to ‘convert(const boost::filesystem::path*, const boost::filesystem::path*, boost::filesystem::path::string_type&)’
     path_traits::convert(seq.c_str(), seq.c_str()+seq.size(), m_pathname);
                                                                         ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:888:73: note: candidates are:
In file included from /home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:25:0,
                 from /home/john/local/boost_1_64_0/include/boost/filesystem.hpp:16,
                 from /home/john/catkin_ws/src/or_urdf/src/boostfs_helpers.h:9,
                 from /home/john/catkin_ws/src/or_urdf/src/urdf_loader.cpp:7:
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:98:10: note: void boost::filesystem::path_traits::convert(const char*, const char*, std::wstring&, const codecvt_type&)
     void convert(const char* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:98:10: note:   candidate expects 4 arguments, 3 provided
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:104:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, const wchar_t*, std::string&, const codecvt_type&)
     void convert(const wchar_t* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:104:10: note:   candidate expects 4 arguments, 3 provided
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:110:10: note: void boost::filesystem::path_traits::convert(const char*, std::wstring&, const codecvt_type&)
     void convert(const char* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:110:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const char*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:119:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, std::string&, const codecvt_type&)
     void convert(const wchar_t* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:119:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const wchar_t*’
In file included from /home/john/local/boost_1_64_0/include/boost/filesystem.hpp:16:0,
                 from /home/john/catkin_ws/src/or_urdf/src/boostfs_helpers.h:9,
                 from /home/john/catkin_ws/src/or_urdf/src/urdf_loader.cpp:7:
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:977:10: note: void boost::filesystem::path_traits::convert(const char*, const char*, std::wstring&)
     void convert(const char* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:977:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const char*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:985:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, const wchar_t*, std::string&)
     void convert(const wchar_t* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:985:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const wchar_t*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:993:10: note: void boost::filesystem::path_traits::convert(const char*, std::wstring&)
     void convert(const char* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:993:10: note:   candidate expects 2 arguments, 3 provided
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:1001:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, std::string&)
     void convert(const wchar_t* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:1001:10: note:   candidate expects 2 arguments, 3 provided
In file included from /home/john/local/boost_1_64_0/include/boost/filesystem/path.hpp:25:0,
                 from /home/john/local/boost_1_64_0/include/boost/filesystem.hpp:16,
                 from /home/john/catkin_ws/src/or_urdf/src/boostfs_helpers.h:9,
                 from /home/john/catkin_ws/src/or_urdf/src/urdf_loader.cpp:7:
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:152:10: note: void boost::filesystem::path_traits::convert(const char*, const char*, std::string&, const codecvt_type&)
     void convert(const char* from, const char* from_end, std::string & to,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:152:10: note:   candidate expects 4 arguments, 3 provided
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:161:10: note: void boost::filesystem::path_traits::convert(const char*, std::string&, const codecvt_type&)
     void convert(const char* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:161:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const char*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:172:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, const wchar_t*, std::wstring&, const codecvt_type&)
     void convert(const wchar_t* from, const wchar_t* from_end, std::wstring & to,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:172:10: note:   candidate expects 4 arguments, 3 provided
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:181:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, std::wstring&, const codecvt_type&)
     void convert(const wchar_t* from,
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:181:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const wchar_t*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:192:10: note: void boost::filesystem::path_traits::convert(const char*, const char*, std::string&)
     void convert(const char* from, const char* from_end, std::string & to)
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:192:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const char*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:200:10: note: void boost::filesystem::path_traits::convert(const char*, std::string&)
     void convert(const char* from, std::string & to)
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:200:10: note:   candidate expects 2 arguments, 3 provided
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:209:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, const wchar_t*, std::wstring&)
     void convert(const wchar_t* from, const wchar_t* from_end, std::wstring & to)
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:209:10: note:   no known conversion for argument 1 from ‘const boost::filesystem::path*’ to ‘const wchar_t*’
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:217:10: note: void boost::filesystem::path_traits::convert(const wchar_t*, std::wstring&)
     void convert(const wchar_t* from, std::wstring & to)
          ^
/home/john/local/boost_1_64_0/include/boost/filesystem/path_traits.hpp:217:10: note:   candidate expects 2 arguments, 3 provided
make[2]: *** [or_urdf/CMakeFiles/or_urdf_plugin.dir/src/urdf_loader.cpp.o] Error 1
make[1]: *** [or_urdf/CMakeFiles/or_urdf_plugin.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

cmake抱怨的代码是:

#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include "boost/version.hpp"

namespace boost 
{ 
#if BOOST_VERSION > 104900
 namespace filesystem3
#else
 namespace filesystem3
#endif
 {
   template < >
   path& path::append< typename path::iterator >( typename path::iterator begin, typename path::iterator end, const codecvt_type& cvt)
   { 
     for( ; begin != end ; ++begin )
       *this /= *begin;
     return *this;
   }

   // Return path when appended to a_From will resolve to same as a_To
   boost::filesystem::path make_relative( boost::filesystem::path a_From, boost::filesystem::path a_To )
   {
     a_From = boost::filesystem::absolute( a_From ); a_To = boost::filesystem::absolute( a_To );
     boost::filesystem::path ret;
     boost::filesystem::path::const_iterator itrFrom( a_From.begin() ), itrTo( a_To.begin() );

     // Find common base
     for( boost::filesystem::path::const_iterator toEnd( a_To.end() ), fromEnd( a_From.end() ) ; 
          itrFrom != fromEnd && itrTo != toEnd && *itrFrom == *itrTo; ++itrFrom, ++itrTo );

     // Navigate backwards in directory to reach previously found base
     for( boost::filesystem::path::const_iterator fromEnd( a_From.end() ); itrFrom != fromEnd; ++itrFrom ) {
       if( (*itrFrom) != "." )
         ret /= "..";
     }

     // Now navigate down the directory branch
     ret.append( itrTo, a_To.end() );
     return ret;
   }
 } 
}

上面的代码超出了我的C ++知识,我无法真正看到错误的出处,但是,此软件包对于构建至关重要,因为它在我的代码中用作第三方库。

0 个答案:

没有答案