【问题标题】:boost::create_directory returns exception in release modeboost::create_directory 在发布模式下返回异常
【发布时间】:2017-07-03 19:01:07
【问题描述】:

我有下面的代码来创建一个目录。

string path = "\\\\hilbert\\MRoot\\2017-05-04"
boost::filesystem::create_directory(path );

当我在调试模式下运行此代码时,此代码有效,但在发布模式下它给了我一个异常。 发布模式的异常是"string iterators incompatible"

我正在使用 Visual Studio 为我的发布和调试模式提供的默认设置。

编辑:我在发布模式下链接到 boost_filesystem-vc110-mt-gd-1_60.lib。我将其更改为 boost_filesystem-vc110-mt-1_60.lib 并开始工作。

【问题讨论】:

标签: c++ visual-studio boost release


【解决方案1】:

你应该使用库 boost 中的对象 path 例如

using namespace boost::filesystem;
path p{"D:\\newDirectory"};
create_directory( p );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-31
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 2021-09-28
    • 2011-02-25
    相关资源
    最近更新 更多