Boost过程中缺少异常

Nor*_*löw 6 c++ exception-handling process-control boost-filesystem

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

svn co svn://svn.boost.org/svn/boost/sandbox/process/ boost-process
Run Code Online (Sandbox Code Playgroud)

添加boost-process到包含path(-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’
Run Code Online (Sandbox Code Playgroud)

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

定义filesystem_error

  class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error
Run Code Online (Sandbox Code Playgroud)

BOOST_SYMBOL_VISIBLE隐藏呢?

Joh*_*nck 13

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

#include <boost/filesystem/path.hpp> 
Run Code Online (Sandbox Code Playgroud)

而是这样说:

#include <boost/filesystem/operations.hpp>
Run Code Online (Sandbox Code Playgroud)

我认为这将使它与Boost Filesystem v3(很快将成为Boost 1.48的唯一版本)兼容.


Ros*_*117 1

我通过在 g++ 命令行上传递 -DBOOST_FILESYSTEM_VERSION=2 来修复此问题。

  • Boost Filesystem v2 已弃用,并计划在即将发布的 Boost 版本中消失。 (2认同)