6

我想使用 Boost Process,尽管它还没有发布。我做了

svn co svn://svn.boost.org/svn/boost/sandbox/process/ boost-process

添加boost-process到包含路径(-I),#included <boost/process.hpp>但编译抱怨filesystem_error未定义:

boost-process/boost/process/operations.hpp: In function ‘std::string boost::process::find_executable_in_path(const string&, std::string)’:
boost-process/boost/process/operations.hpp:85:36: error: ‘filesystem_error’ is not a member of ‘boost::filesystem3’
In file included from boost-process/boost/process.hpp:42:0,
                 from tests/../fio.hpp:22,
                 from tests/t_histogram.cpp:18:
boost-process/boost/process/operations.hpp:130:32: error: ‘filesystem_error’ is not a member of ‘boost::filesystem3’

我尝试将命名空间更改为boost::filesystem3但结果相同。

的定义filesystem_error

  class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error

BOOST_SYMBOL_VISIBLE隐藏了吗?

4

2 回答 2

13

您需要编辑 process/operations.hpp 以删除它:

#include <boost/filesystem/path.hpp> 

而是这样说:

#include <boost/filesystem/operations.hpp>

我认为这将使它与 Boost Filesystem v3 兼容(这将很快成为唯一的版本,计划用于 Boost 1.48)。

于 2012-03-21T00:10:04.227 回答
2

我通过在我的 g++ 命令行上传递 -DBOOST_FILESYSTEM_VERSION=2 来解决这个问题。

于 2012-03-21T00:01:01.600 回答