我使用XCODE 5在MAC OS X上构建了一个非常简单的应用程序。我正在尝试使用boost :: filesystem库创建一个目录。它编译并构建好了。但是create_directories似乎有一些问题。我复制了下面的调用堆栈。任何人都知道什么是错的?
#include <iostream>
#include <fstream>
#include "boost/filesystem.hpp"
using namespace boost::filesystem;
using namespace std;
int main(int argc, const char * argv[])
{
const string dir_path = "/Users/js/temp/";
boost::filesystem::path dir(dir_path);
boost::filesystem::create_directories(dir);
return 0;
}
跟踪:
------call stack----
#0 0x000000010000ddd0 in std::string::size() const [inlined] at /usr/include/c++/4.2.1/bits/basic_string.h:606
#1 0x000000010000ddcd in boost::filesystem::path::m_parent_path_end() const at /Users/shuj/boost_1_55_0/libs/filesystem/src/path.cpp:328
#2 0x000000010000e645 in boost::filesystem::path::parent_path() const at /Users/shuj/boost_1_55_0/libs/filesystem/src/path.cpp:349
#3 0x0000000100009189 in boost::filesystem::detail::create_directories(boost::filesystem::path const&, boost::system::error_code*) at /Users/shuj/boost_1_55_0/libs/filesystem/src/operations.cpp:931
#4 0x000000010000199f in boost::filesystem::create_directories(boost::filesystem::path const&) at /Users/shuj/boost_1_55_0/lib/include/boost/filesystem/operations.hpp:399
#5 0x000000010000110b in main at /Users//Desktop/Projects/HelloWorld/HelloWorld/main.cpp:24
failed on this line
size() const
{ return _M_rep()->_M_length; }